How to recognize text containing only numbers

There are two ways to recognize text containing only numbers:

A. Use Predefined Text Languages

Use the Digits predefined text language.

Sample code in C#:

//load image
FREngine.FRDocument document = engineLoader.Engine.CreateFRDocumentFromImage(@"D:\Demo.tif");
//process the document using the created language
FREngine.PageProcessingParams p = engineLoader.Engine.CreatePageProcessingParams();
p.RecognizerParams.SetPredefinedTextLanguage("Digits");
document.Process(p); 

Note:  "Digits" text language contains other common symbols, typical for digit-only fields, such as decimal separator sign (comma or dot), minus and etc. Here is the full list:

()+,-./:=#$([{¢£€%).]}°¼½¾%—‹›

B. Specify the alphabet directly

  1. Сreate BaseLanguage object and set its alphabet
  2. Сreate corresponding TextLanguage object
  3. Process the document using the created language

Sample code in C#:

 FREngine.ILanguageDatabase languageDatabase = engineLoader.Engine.CreateLanguageDatabase();
FREngine.ITextLanguage textLanguage = languageDatabase.CreateTextLanguage();
FREngine.IBaseLanguage baseLanguage = textLanguage.BaseLanguages.AddNew();
baseLanguage.LetterSet[FREngine.BaseLanguageLetterSetEnum.BLLS_Alphabet] = "0123456789";

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Recently viewed