Google Translate get synonyms and examples - google-app-engine

Can I access word's synonyms and examples along with the translation itself, when using Google Translate API?
I checked out docs but I don't see anything like that.

No, you cannot get the synonyms and examples along with the translated text.As currently they have only 3 methods in the Translate API.The 3 methods are detections.list, languages.list and translations.list. So i think it would be great if you make a feature request for this API at PIT of AppEngine.

Pearson released their free API which includes examples, part of speech, and synonyms. Check it out: http://developer.pearson.com/apis/dictionaries
http://api.pearson.com/v2/dictionaries/lase%20/entries?headword=hola
{
"status": 200,
"offset": 0,
"limit": 10,
"count": 1,
"total": 1,
"url": "/v2/dictionaries/lase /entries?headword=hola",
"results": [
{
"datasets": [
"lase",
"dictionary"
],
"headword": "hola",
"id": "ct59rx0q97",
"part_of_speech": "interjection",
"senses": [

Related

Gatling: extraction crashed: end of input expected error while paring json response

Here is the JSON Response:
[{
"startTime": "2020-07-21T15:20:00.000+00:00",
"endTime": "2020-07-21T15:40:00.000+00:00",
"availabilities": [{
"availabilityId": "eyJJZCI6MTA4N",
"startTime": "2020-07-21T15:20:00.000+00:00",
"endTime": "2020-07-21T15:40:00.000+00:00",
"channel": "PHONE",
"programId": "Msff",
"providerDetails": {
"firstName": "abc",
"lastName": "abc",
"providerTitle": "NURSE"
}
}]
}, {
"startTime": "2020-07-21T15:40:00.000+00:00",
"endTime": "2020-07-21T16:00:00.000+00:00",
"availabilities": [{
"availabilityId": "eyJJZCI6MTA4NDM2MiwiU3RhcnRUa",
"startTime": "2020-07-21T15:40:00.000+00:00",
"endTime": "2020-07-21T16:00:00.000+00:00",
"channel": "PHONE",
"programId": "Msff",
"providerDetails": {
"firstName": "def",
"lastName": "def",
"providerTitle": "NURSE"
}
}]
}]
And here is the check i am using to extract the first "availabilityId" from json response
check(
jsonPath("$[0][availabilities].[0].availabilityId") saveAs "availabilityId"
)
but i am getting error:
jsonPath($[0][availabilities].[0].availabilityId).find.exists extraction crashed: end of input expected
I validated the path on https://jsonpath.com/, i am able to see the result. What am i doing wrong?
That's an example of how bad JsonPath is in its current state:
JsonPath currently doesn't have a real specification
because of holes in the original "paper" (a simple blog post actually) and implementors going with their own interpretation and likings, there are A LOT of differences between implementations
jsonpath.com isn't currently a reference, just someone who bought the domain name
Here, if you check the original source, you'll see that the square notation is supposed to use single quotes to wrap field name:
JSONPath expressions can use the dot–notation
$.store.book[0].title
or the bracket–notation
$['store']['book'][0]['title']
What happens here is that the Gatling implementation sticks to this definition while the JavaScript one used on jsonpath.com allows for ditching the single quotes.
Also, you shouldn't have dots between your brackets, so your path should be:
$[0]['availabilities'][0].availabilityId
You could also stick to the more common dot notation:
$[0].availabilities[0].availabilityId
There's an ongoing effort on creating a proper JsonPath implementation. Until this effort lands, we from Gatling recommend going with JMESPath instead, as explained here. On contrary to JsonPath atm, JMESPath has a real complete grammar and a compliance test suite.
You have added unnecessary square brackets. Change jsonPath on:
$.[0].availabilities.[0].availabilityId

How can I build this kind of UI, from AWS Comprehend Medical?

I'm using the AWS machine learning service Comprehend Medical to analyse clinical texts and extract data.
Some context info (skippable maybe):
This is the type of input:
Pt is 40yo mother, highschool teacher
HPI : Sleeping trouble on present dosage of Clonidine. Severe Rash on face and leg, slightly itchy
Meds : Vyvanse 50 mgs po at breakfast daily,
Clonidine 0.2 mgs -- 1 and 1 / 2 tabs po qhs
HEENT : Boggy inferior turbinates, No oropharyngeal lesion
Lungs : clear
Heart : Regular rhythm
Skin : Mild erythematous eruption to hairline
Follow-up as scheduled
This is the kind of output I get from AWS:
{
"Entities": [
{
"Id": 0,
"BeginOffset": 6,
"EndOffset": 10,
"Score": 0.9984116554260254,
"Text": "40yo",
"Category": "PROTECTED_HEALTH_INFORMATION",
"Type": "AGE",
"Traits": []
},
{
"Id": 1,
"BeginOffset": 19,
"EndOffset": 37,
"Score": 0.28823626041412354,
"Text": "highschool teacher",
"Category": "PROTECTED_HEALTH_INFORMATION",
"Type": "PROFESSION",
"Traits": []
},
...
Then I would like to render this kind of UI, the same way AWS does in their console to represent Comprehend medical outputs (see the image) :
AWS Console Comprehend Medical output representation
I managed to tag the text. But I have no idea in how to make the tagged arrows: represent those dependecies between html elements.
I have tried some react libraries like Taggy(only do tagging) and explored some other solutions like Spacey (will require SSR and not even the same output of tags + tagged arrows ),
Anyone could suggest an approach to do this kind of tagged arrows between those html components?
Thank you ma people.

Split an array into a JSON with two arrays in a logic app

I have this JSON:
[
{
"ParentReasonId": 2,
"ParentReason": "Violent or repulsive content",
"ReasonId": 15,
"Reason": "Adults fighting"
},
{
"ParentReasonId": 2,
"ParentReason": "Violent or repulsive content",
"ReasonId": 16,
"Reason": "Physical attack"
}
]
With azure logic apps i'm trying to transform the array into a json of two arrays:
{
"categories": [
{
"categoryId": 2,
"category": "Violent or repulsive content"
}
],
"reasons": [
{
"categoryId": 2,
"reasonId": 15,
"reason": "Adults fighting"
},
{
"categoryId": 2,
"reasonId": 16,
"reason": "Physical attack"
}
]
}
How can i achieve this using azure logic apps? The data is coming from a sql stored procedure action.
After the data from your SQL Server you could do one of the following
Use Azure Functions
You could simply have an azure function which performs the transformation that you need and which will be called from your Logic Apps.
Refer the Custom Code with Azure Functions doc for more information on how to achieve this.
This is likely the easiest and more cost effective solution.
Use Integration Account & Liquid Templates
If you'd want to avoid having code to write and maintain, you could take this approach which involves writing a liquid template for your transformation, uploading it to an integration account and calling it from your Logic App.
Refer the Transform JSON doc for more information on how to achieve this.
Though this approach avoids maintaining code, note that Integration Accounts incur an hourly fee. If you have lots of such transformations, it would probably make sense to go with this.
Also, you could try to achieve the same with the built-in connectors & workflow definition language functions that Logic Apps provide but would probably be a bit too complex.

searching an array deep inside a mongo document

in my mongo collection called pixels, I have documents like the sample
I'm looking for a way to search in the actions.tags part of the documents?
db.pixelsactifs.actions.find({tags:{$in : ["Environnement"]}})
db.pixelsactifs.find({actions.tags:{$in : {Environnement}})
doesn't work. I'm also looking for the PHP equivalent ?
I'm also asking myself should I make an "actions" collection instead of putting everything inside one document
I'm new to mongo so any good tutorial on structuring the db would be great
Thanks for the insight
{
"_id": { $oid": "51b98009e4b075a9690bbc71" },
"name": "open Atlas",
"manager": "Tib Kat",
"type": "Association",
"logo": "",
"description": "OPEN ATLAS",
"actions": [
{
"name": "Pixel Humain",
"tags": [ "Toutes thémathiques" ],
"description": "le PH agit localement",
"images": [],
"origine": "oui",
"website": "www.echolocal.org"
}
],
"email": "my#gmail.com",
"adress": "102 rue",
"cp": "97421",
"city": "Saint louis",
"country": "Réunion",
"phone": "06932"
}
you can try like this
collectionName->find(array("actions.tags" => array('$in' => "Environnement")));
I do not think you need to maintain the actions in separate collection. NoSQL gives you more flexibility to do embed th document . Event it allows sub document also be indexed . True power of NoSQL comes with merging the document into each other to get the faster retrieval. The only short coming I can see here , you can not get the part of sub document . find will always return the complete Parent document. In case you want to show one entry of subdocument array , it is not possible . It will return the whole subdocument and you have to filter in on the client side. So if you are planning to show action as individual to end user , it is better to have in separate collection
Read here : http://docs.mongodb.org/manual/use-cases/

graph api array comments and updates

I was wondering how i would display the comments story tags with the following array....
{ "data": [ {
"id": "1364392319_4278554326462",
"from": {
"name": "Dave Morin",
"id": "1364392319" },
"story": "Dave Morin was tagged in Shae Rachael Garton's album Mobile Uploads.",
"story_tags": {
"0": [ {
"id": 1364392319,
"name": "Dave Morin",
"offset": 0,
"length": 10,
"type": "user" } ],
"25": [ {
"id": 100000204772261,
"name": "Shae Rachael Garton",
"offset": 25,
"length": 19, "type": "user" } ] },
Obviously its layed out better but thats the best i could grab :)
I don't completely understand your question, but it sounds like you're asking how to best use the information in the story_tags parameter to recreate the way Facebook highlights the username when such a post is displayed on Facebook.com?
It would help to know what code are you using and what the problem is if you want specific code examples, because it looks like you have the data you need there, but:
For each entry in the story_tags array:
id is the User or Page ID linked to by this tag
name is the name of that object
offset is the first character in the original message which should be highlighted/linked (i.e In this case, the original message is the story on the next level out` )
length is the number of characters to be highlighted/linked
type is the type of object linked in the tag
So for the example there:
Dave Morin was tagged in Shae Rachael Garton's album Mobile Uploads.
Tagging at offset 0 for 10 characters and offset 25 for 19 would highlight it like this:
Dave Morin was tagged in Shae Rachael Garton's album Mobile Uploads.
With the first link linking to Dave's profile and the second to Shae's

Resources