V3 extends VNRecognizeTextRequest with automaticallyDetectsLanguage - If I turn this on, how do I discover what language it decided to use?
Vision will not tell you which languages have been detected. The intent of this is to allow the client to give a "hint" to the algorithm.
If you already know the language up-front, it's best to specify that language explicitly, which allows the framework to target that language for better accuracy. If you do not, it's better to set automaticallyDetectsLanguage
to true
, which essentially is communicating to the framework "I don't know which language" and the framework will do its best to decode any language.
You can use NLLanguageRecognizer
to detect the dominate language after the text has been extracted by Vision.
Usually a sentence is sufficient to identify language. You can pass in as much as you like, but the algorithm limits the amount of text it will consider. Less than maybe 5-10 words is challenging.
If you have some prior information as to what the language might be, you can also pass hints and/or constraints to NLLanguageRecognizer
.