Google translate API with annotations - google-translate

When using the Google Translate API, it just returns one translation for a given word. For example, when I let it translate the English word "hide" to Italian, it just responds with "nascondere".
However, Google Translate on the web offers much more: they don't just show one translation (or list of possible translations), but also the frequency as well as the precise meaning of a specific translation:
I'd like to get these results via an API.
Is there a public API that offers the same results?
Of course, I could just use the endpoint /translate_a/single that is used by the Google Translate website. But this endpoint does not include an API key, so if I send too many requests, they will most likely block me.
Also, the endpoint /translate_a/single returns many fields of which I do not know the precise meaning, so its usage would most likely involve some reverse engineering.

Related

Can Google Cloud Vision generate labels in Spanish via its API?

say that I have images and I want to generate labels for them in Spanish - does the Google Cloud Vision API allow to select which language to return the labels in?
Label Detection
Google Cloud Vision APIs do not allow configuring the result language for label detection. You will need to use a different API like Cloud Translation API to perform that operation instead.
OCR (Text detection)
If you're interested in text detection in your image, Google Cloud Vision APIs support Optical Character Recognition (OCR) with automatic language detection in a broad set of languages listed here.
For TEXT_DETECTION and DOCUMENT_TEXT_DETECTION requests, you can provide languageHints parameter in the request to get better results for certain cases where the language is unknown and/or not easily detectable.
languageHints[]
string
List of languages to use for TEXT_DETECTION. In most cases, an empty
value yields the best results since it enables automatic language
detection. For languages based on the Latin alphabet, setting
languageHints is not needed. In rare cases, when the language of the
text in the image is known, setting a hint will help get better
results (although it will be a significant hindrance if the hint is
wrong). Text detection returns an error if one or more of the
specified languages is not one of the supported languages.
The DetectedLanguage information is available in the request to identify the language along with a confidence value.
Detected language for a structural component.
JSON representation
{
"languageCode": string,
"confidence": number,
}

Using Google Places Search without violating terms

As the title says, my app takes parameters from the user and displays relevant locations around them. But from what I understand, the Google Maps API terms prohibit you from doing this. Can this use be termed as a listing service, where I'm simply displaying the data I got from Google. I'm also providing all relevant attributions.

Google reviews counter

I want to know if there is any api that can allow me to get the number of reviews from an url.
I know that google offers the possibility to get this number by using the placeid, but the only information I have is the url of the website of a company.
Any ideas please?
Maybe, but probably not.
Places API Text Search seems to be able to find places by their URL:
https://maps.googleapis.com/maps/api/place/textsearch/json?key=YOURKEY&query=http://www.starbucks.com/store/1014527/us/303-congress-street/303-congress-street-boston-ma-02210
However, this is not a documented feature of the API and I do not think this can be relied upon, so I'd recommend filing a feature request, to make this a supported, reliable feature.
As for the amount of reviews, you may be interested in:
Issue 3484: Add # of reviews to the Place Details Results
I've written an API like this for Reviewsmaker, but I target specific business names not URLs. See this example (I activated a key for this purpose for now):
http://reviewsmaker.com/api/google/?business=life%20made%20a%20little%20easier&api_key=4a2819f3-2874-4eee-9c46-baa7fa17971c
Or, try yourself with any business name:
http://reviewsmaker.com/api/google/?business=Toys R Us&api_key=4a2819f3-2874-4eee-9c46-baa7fa17971c
The following call would return a JSON object which shows:
{
"results":{
"business_name":"Life Made A Little Easier",
"business_address":"1702 Sheepshead Bay Rd, Brooklyn, NY 11235, USA",
"place_id":"ChIJ_xjIR2REwokRH2qEigdFCvs",
"review_count":38
},
"api":{
"author":"Ilan Patao",
"home":"www.reviewsmaker.com"
}
}
Pinging this EP using a Chronjob for example once every hour or two and return the review_count can pretty much build your own review monitoring app;
You can probably do what you're looking for if you query the Places API Text Search or the CSE (Custom Search Engine) API to lookup the URL, return back the matching name of the business associated with this URL and calling an endpoint like this one to return back the associated review count.
You can probably code this in py or PHP. Not sure how familiar you are with data parsing, but I was able to build my API based on Google's CSE API. CSE provides metadata in its results which contain the total reviews, so if you create a CSE engine and use the CSE API looking for business schemas, review schemas, etc; you can return back items and within the PageMap node there are objects with data that you need very little tweaking to do (such as string replacing, trimming) which will return back the values you're looking for.
Hope my answer helped, at least to lead you in the right direction :)

Why is "natural_feature" excluded from Google Maps Geocoding and Places API searches?

Trying to mimic the 'what's here' feature of Google Maps in my own website but it seems that items of type 'natural_feature' are excluded from Google Maps 3 API geocoding and places searches, both nearby and radar, and also on text searches unless the EXACT name of the place is provided. This must have been an informed choice by Google to do this - anyone know the rationale, and better, offer a workaround? Seems crazy that I can't get the names of woods, nature reserves etc. any more...
Found out how to do it! If you get a geocoding API key from Google you can get all the data for natural features included in the JSON/XML response from a server request like the following (I was trying to get the data for "Gamsey Wood"):
https://maps.googleapis.com/maps/api/geocode/json?latlng=52.4180698,-0.2029999&result_type=natural_feature&key=YOUR_GOOGLE_GEO_KEY
Happy days!

Google Places api vs Google Maps search

I have successfully used Google Places Api and was able to retrieve business establishments (shops) given a latlongbound and a keyword. But I cant stop wondering why it returns lesser shops than when you go to maps.google.com and type the keyword. Google Places does not even return those with a name and icon drawn on the map itself.
I want to retrieve a json with a similar result when typing a keyword on maps.google.com and I don't really mind if Google Places is not used.
Sounds like you may have additional filtering preventing you from querying all the results. Make sure you aren't restricting the 'bounds' or 'region' around your lat/long.
https://developers.google.com/maps/documentation/geocoding/
Good luck!

Resources