Code samples for language detection

If each page contains only one language, and the language is known, the language can be set by the kRecManageLanguages(sid, SET_LANG, language); command.

If pages can contain multiple languages from a known set of languages, set the possible languages with the kRecManageLanguages command before preprocessing the image. It is recommended to set maximum five languages. The more languages you set, the higher the chance of recognition errors.

If each page contains only one language, and the language is unknown, use automatic single language detection (ASLD) as described in the example below. It is recommended to set maximum five languages and ASLD chooses one of them. The following limitations apply:

  • Greek, Russian (Cyrillic) and Thai languages and scripts are not recommended.

  • Western (Latin) languages without dictionary are not supported.

If the detection process cannot determine the page language, the language of the previous page is set, and LANGDET_INHERITED_WARN is returned by kRecGetPageLanguages.