VNRecognizeTextRequest recognitionLanguages

Hello,

With support for new languages introduced with VNRecognizeTextRequestRevision2, I'm wondering how should we approach setting the recognitionLanguages when instantiating the VNRecognizeTextRequest.


Question 1


I want my text recognition to support all new languages: ["en-US", "fr-FR", "it-IT", "de-DE", "es-ES", "pt-BR", "zh-Hans", "zh-Hant"], but I don't necessarily always know the language of a text beforehand.

Should we:

1. Set recognitionLanguages to all available languages.
2. Omit setting recognitionLanguages altogether.
3. Try to define the text language beforehand, and:
  • a. set the recognitionLanguages only to that language, or

  • b. set the recognitionLanguages to all available languages, sorted by the text language first?


Question 2


Also, are there any performance implications for setting multiple recognitionLanguages compared to just one?
Answered by Engineer in 627729022
Setting multiple recognitionLanguages won't have a performance impact compared to just one.

However, passing an array of all the languages most likely won't achieve what you are trying to do, and you may need to create more than one request to cover all the languages. See "Optimize Language Settings" section in the below article:

https://developer.apple.com/documentation/vision/recognizing_text_in_images

"To recognize traditional and simplified Chinese, specify zh-Hant and zh-Hans as the first elements in the request’s recognitionLanguages property. English is the only other language that you can pair with Chinese."
Accepted Answer
Setting multiple recognitionLanguages won't have a performance impact compared to just one.

However, passing an array of all the languages most likely won't achieve what you are trying to do, and you may need to create more than one request to cover all the languages. See "Optimize Language Settings" section in the below article:

https://developer.apple.com/documentation/vision/recognizing_text_in_images

"To recognize traditional and simplified Chinese, specify zh-Hant and zh-Hans as the first elements in the request’s recognitionLanguages property. English is the only other language that you can pair with Chinese."
VNRecognizeTextRequest recognitionLanguages
 
 
Q