Can Google Cloud Vision generate labels in Spanish via its API? - google-cloud-vision

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,
}

Related

Which natural languages does Google Cloud DLP support?

I'm considering using Cloud DLP to help me anonymize my data. However, I can't seem to find explicit mention of what languages are supported. AWS Comprehend's detect PII API only supports English so looking for an alternative.
In the detectors reference page you can find the detectors per country
https://cloud.google.com/dlp/docs/infotypes-reference
For global detectors as PHONE_NUMBER there is no information about the languages supported, but you can test the support for your language in the demo page
https://cloud.google.com/dlp/demo/#!/
For example if you write in Spanish Mi teléfono es 600111222 (my phone is 600111222) it detects a PHONE_NUMBER with LIKELY likelihood, but if you write Me puedes llamar al 600111222 (You can call me at 600111222) it detect just a GENERIC_ID with LOW likelihood.
Also, if in the previous examples, you add the country prefix (+34600111222), the likelihood increases to VERY_LIKELY in the first one and the second one detects a PHONE_NUMBER as POSSIBLE
In summary, it works with other languages and uses the context to improve the matches, but you should play with some samples to check the accuracy in your specific use case

Google translate API with annotations

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.

Cognitive Services Translation and Profanity Filtering

Issue Description
I use cognitive services TranslateArray to translate my users comments. One of the advantages of this service is that we can use ProfanityAction to mark every profane words in the destination language. I also make use of the automatic language detection, so that I do not have to identify the content before sending it in.
When I get my translation back for a destination language which match the source language, the profanity is not marked. Is there another endpoint I could/should hit, or a parameter I do not know about, or is there a possible improvement of the service ?
Corresponding Documentation
Follow the cognitive service protocol to hit the TranslateArray endpoint, with an english sentence containing profanities, with the ProfanityAction: Marked behavior: http://docs.microsofttranslator.com/text-translate.html#!/default/post_TranslateArray
Reproduction Steps
Send an English sentence with profanities
Translate to fr, notice correctly marked profanities
Translate to en, notice the missing profanities tag
Expected Behavior
Profanities should be marked even if no translation occured.
Actual Results
I obtained the unmodified sentence back.
There is nothing in the documentation that specifies what happens if the source and target language are the same. My guess is that if it sees that they match it will do nothing.
However, there is a specific API that detects profanity for any given language: Content Moderation for Text. The API docs are here.
The Text - Screen function does it all – scans the incoming text (maximum 1024 characters) for profanity, autocorrects text, and extracts Personally Identifiable Information (PII), all while matching against custom lists of terms.
Your observation that Translator API does nothing if source and target languages are the same, is correct. Not an answer, just clarification.

Can text structure be retained using Google Cloud Vision TEXT_DETECTION?

Version 1 of the Google Cloud Vision API (beta) permits optical character recognition via TEXT_DETECTION requests. While recognition quality is good, characters are returned without any hint of the original layout. Structured text (e.g., tables, receipts, columnar data) are therefore sometimes incorrectly ordered.
Is it possible to preserve document structure with the Google Cloud Vision API? Similar questions have been asked of tesseract and hOCR. For example, [1] and [2]. There is currently no information about TEXT_DETECTION options in the documentation [3].
[1] How to preserve document structure in tesseract
[2] Tesseract - ambiguity in space and tab
[3] https://cloud.google.com/vision/
Recognizing the text structure is a more abstract concept than to recognize the text itself : letters,words,sentence. If you already have this text structure information in your file metadata you could do something like :
Segment/divide your input image in subparts.
Execute your text_detection requests.
Re-order your text correctly based on your meta-data.
I'm not an expert in Cloud Vision text_detection API but it's written text_detection not language_detection or text_structure_detection, so it gives some little clues about the detection level/layer.
Maybe it's a feature they are planning to add in the future or describe in the documentation.

List of Dimensions and Metrics in different languages

The Metadata API can be used to get a list of google analytic dimensions and metrics. Is it possible to have this list returned in different languages? Is there a list/database of the metrics and dimensions for different languages?
The MetaData API only returns in english there is no way to change the language. I dont think they will be changing that anytime soon. But you could try adding it as a feature request. http://code.google.com/p/analytics-issues/issues/list

Resources