RecognizerParams / TextLanguage in FREngine12

  • 21 Views
  • Last Post 5 days ago
  • Topic Is Solved
robert.kersten posted this 2 weeks ago

Hello Abbyy team,

I get an issue during update from FREngine v11 to v12 - using the java libs.

In v11 the following code worked fine.
in v12 the engine also runs without technical errors, but german special chacacters are not recognized anymore - e.g. the engine returns "ii" instead of "ü" or "a" instead of "ä"

Apparently RecognizerParams / TextLanguage are ignored (?)
Was there a change, I haven't respected so far?

engine = Engine.InitializeEngine(...)
engine.LoadPredefinedProfile("TextExtraction_Accuracy");
final IPredefinedLanguage german = engine.getAvailablePredefinedLanguages().Find("GermanNewSpelling");
final IRecognizerParams recognizerParams = engine.CreateRecognizerParams();
recognizerParams.setTextLanguage(german.getTextLanguage());
recognizerParams.setSaveWordRecognitionVariants(true);
final IDocumentProcessingParams documentProcessingParams = engine.CreateDocumentProcessingParams();
<...>
final IFRDocument document = engine.CreateFRDocument();
document.AddImageFileFromMemory(...)
document.Process(documentProcessingParams);

Alternatively I tried to set RecognizerParams via DocumentProcessingParams - without any impact.

final IDocumentProcessingParams documentProcessingParams = engine.CreateDocumentProcessingParams();
final IRecognizerParams recognizerParams =documentProcessingParams.getPageProcessingParams().getRecognizerParams();
recognizerParams.setTextLanguage(german.getTextLanguage());
recognizerParams.setSaveWordRecognitionVariants(true);
recognizerParams.setLanguageDetectionMode(ThreeStatePropertyValueEnum.TSPV_No);

Any hints?

Best regards

Robert Kersten

robert.kersten posted this 5 days ago

The alternative Code is working - I tricked myself by an unexpected caching.

In the original code a line to set the RecognizerParams to the DocumentProcessingParams is missing:

documentProcessingParams.getPageProcessingParams().setRecognizerParams(recognizerParams);

Nonetheless the code without setRecognizerParams is delivering correct results in v11 - I don't know why ... maybe I have another sideeffect somewhere that sets the language anyway ...

Close