Reputation: 49
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?
Upvotes: 3
Views: 1148
Reputation: 49483
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.
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, }
Upvotes: 3