Skip to main content
This object represents the language of recognition for a text. The text language in general case is a set of base languages or languages of a single word. Access to the collection of base languages of a text is provided through the BaseLanguages property. Besides, this object exposes methods for accessing different text language attributes such as its internal name, groups of letter sets, etc. The TextLanguage object is a persistent object. This means that the object’s current state can be written to persistent storage. Later, the object can be re-created by reading the object’s state from the persistent storage. The following methods provide persistence of the object: Linux: SaveToFile, and LoadFromFile Windows SaveToFile, LoadFromFile, SaveToMemory, and LoadFromMemory.

Properties

Name

Type

Description

Application

Engine, read-only

Returns the Engine object.

Main attributes

InternalName

BSTR

Stores the internal name of the text language. As the internal name may be used to identify the language, it is better be unique.

After a new object of the TextLanguage type is created, this property stores empty string. You may assign it some unique value to identify your text language among others.

By default, this property contains an empty string.

LetterSet

BSTR

Sets additional letter sets for the text language.

RecognitionSet

BSTR, read-only

Returns the full letter set used for recognition with this TextLanguage, combining all letter sets of its base languages and additional letter sets.

BaseLanguages

BaseLanguages, read-only

Returns a reference to the collection of base languages of the current text language. This collection always exists though contains no elements by default.

ProhibitingDictionaries

DictionaryDescriptions, read-only

Returns a reference to the collection of prohibiting dictionaries.

Additional attributes

ImpliedTextCategory

TextCategoryEnum

Specifies the category of text for which the current text language is designed.

By default, this property contains the TC_Unknown value, which means that the text language can be used for recognition of all types of text.

UserProperty

VARIANT

Allows you to associate any user-defined information with an object of the TextLanguage type.

Methods

NameDescription
CopyFromInitializes properties of the current object with values of similar properties of another object.
LoadFromFileRestores the object contents from a file on disk.
LoadFromMemory <Note> : Windows only. </Note>Restores the object contents from the global memory.
SaveToFileSaves the object contents into a file on disk.
SaveToMemory <Note> : Windows only. </Note>Saves the object contents into the global memory.
TextLanguage Object Diagram

Output parameter

This object is the output parameter of the CreateTextLanguage, CreateCompoundTextLanguage method of the LanguageDatabase object.

Samples

FREngine.IEngine engine;
// Create new TextLanguage object
FREngine.ILanguageDatabase languageDatabase = Engine.CreateLanguageDatabase();
FREngine.ITextLanguage textLanguage = languageDatabase.CreateTextLanguage();
// Copy all attributes from predefined English language
FREngine.ITextLanguage englishLanguage = Engine.PredefinedLanguages.Find( "English" ).TextLanguage;
textLanguage.CopyFrom( englishLanguage );
textLanguage.InternalName = "SampleTextLanguage";
// Change some attributes, attach a dictionary to the language
...
// Use the language for recognition
FREngine.IDocumentProcessingParams documentProcessingParams = Engine.CreateDocumentProcessingParams();
documentProcessingParams.PageProcessingParams.RecognizerParams.TextLanguage = textLanguage;
document.Process( documentProcessingParams );
The object is used in the following code samples:

See also

Working with Languages Working with Properties