> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Dictionary Object (IDictionary Interface)

This object is designed for working with user dictionaries and dictionary extensions. User dictionaries are dictionaries that contain word forms of words of a certain language. Each word form in the dictionary has its own weight that defines its priority when there appear several variants for a word during recognition. The weight may have a set of discrete values. The range of values is from 0 to 100. User dictionaries may be connected to the [BaseLanguage](/fine-reader/engine/api-reference/language-related-objects/baselanguage) object — object representing one base recognition language. Dictionary extensions may exist only for those languages which have standard dictionary support.

A pointer to the Dictionary object interface may be obtained from the [CreateNewDictionary](/fine-reader/engine/api-reference/language-related-objects/languagedatabase/createnewdictionary-method), [OpenExistingDictionary](/fine-reader/engine/api-reference/language-related-objects/languagedatabase/openexistingdictionary-method), or [OpenDictionaryExtension](/fine-reader/engine/api-reference/language-related-objects/languagedatabase/opendictionaryextension-method) methods of the [LanguageDatabase](/fine-reader/engine/api-reference/language-related-objects/languagedatabase) object. The OpenExistingDictionary method can open dictionaries created with the help of the CreateNewDictionary method. The OpenDictionaryExtension provides access to the interface of a dictionary extension.

<Note>
  In Windows, the [Edit](/fine-reader/engine/api-reference/language-related-objects/dictionary/edit-method) method displays the [Dictionary dialog box](/fine-reader/engine/api-reference/language-related-objects/dictionary/edit-method/dictionary-dialog-box) that allows a user to edit the dictionary and to import any text file in Windows ANSI- and Unicode-encoding (the only requirement is that words must be separated by spaces or other non-alphabetic characters).
</Note>

## Properties

| Name        | Type                                                                                                                                                                                                          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Application | [Engine](/fine-reader/engine/api-reference/engine-object-iengine-interface), [read-only](/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties#readonly_properties) | Returns the Engine object.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| Name        | [BSTR](/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties)                                                                                                       | Stores the name of the dictionary. In Windows, this name displays at the caption of the [Dictionary dialog box](/fine-reader/engine/api-reference/language-related-objects/dictionary/edit-method/dictionary-dialog-box). After creation of the Dictionary object this property stores the name of the dictionary file (without path and extension). You may assign it any other value. This property is not saved into the file associated with the dictionary, and should be initialized every time the dictionary is edited. |
| WordsCount  | [int](/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties), read-only                                                                                             | Returns the number of words in the dictionary.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

## Methods

| Name                                                                                                                                        | Description                                                                                                                                                                                         |
| ------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AddWord](/fine-reader/engine/api-reference/language-related-objects/dictionary/addword-method)                                             | Adds a word to the dictionary.                                                                                                                                                                      |
| [AddWords](/fine-reader/engine/api-reference/language-related-objects/dictionary/addwords-method)                                           | Adds a group of words to the dictionary.                                                                                                                                                            |
| [DeleteAllWords](/fine-reader/engine/api-reference/language-related-objects/dictionary/deleteallwords-method)                               | Deletes all words from the dictionary.                                                                                                                                                              |
| [DeleteWord](/fine-reader/engine/api-reference/language-related-objects/dictionary/deleteword-method)                                       | Deletes a word from the dictionary.                                                                                                                                                                 |
| [DeleteWords](/fine-reader/engine/api-reference/language-related-objects/dictionary/deletewords-method)                                     | Deletes a group of words from the dictionary.                                                                                                                                                       |
| [Edit](/fine-reader/engine/api-reference/language-related-objects/dictionary/edit-method) <br /><br /> **Note:** *Implemented for Windows.* | Displays the [Dictionary dialog box](/fine-reader/engine/api-reference/language-related-objects/dictionary/edit-method/dictionary-dialog-box) that allows a user to edit the dictionary.            |
| [EnumWords](/fine-reader/engine/api-reference/language-related-objects/dictionary/enumwords-method)                                         | Returns an object of the [EnumDictionaryWords](/fine-reader/engine/api-reference/language-related-objects/enumdictionarywords) type that allows you to iterate through the words in the dictionary. |

## Output parameter

This object is the output parameter of the [CreateNewDictionary](/fine-reader/engine/api-reference/language-related-objects/languagedatabase/createnewdictionary-method), [OpenExistingDictionary](/fine-reader/engine/api-reference/language-related-objects/languagedatabase/openexistingdictionary-method), [OpenDictionaryExtension](/fine-reader/engine/api-reference/language-related-objects/languagedatabase/opendictionaryextension-method) methods of the [LanguageDatabase](/fine-reader/engine/api-reference/language-related-objects/languagedatabase) object.

## Samples

<Accordion title="C# code">
  ```csharp theme={null}
  // The sample code creates a user dictionary and assigns it to a base language
  FREngine.IEngine engine;
  string dictionaryFileName = "D:\\Sample.amd";
  FREngine.IBaseLanguage baseLanguage;
  // Create new dictionary
  ILanguageDatabase languageDatabase = Engine.CreateLanguageDatabase();
  IDictionary dictionary = languageDatabase.CreateNewDictionary( dictionaryFileName,
   LanguageIdEnum.LI_EnglishUnitedStates );
  dictionary.Name = "SampleUserDictionary";
  // Add words to dictionary
  dictionary.AddWord( "the", 100 );
  dictionary.AddWord( "a", 100 );
  dictionary.AddWord( "an", 100 );
  // Get collection of dictionary descriptions of a base language and remove all items
  IDictionaryDescriptions dictionaryDescriptions = baseLanguage.DictionaryDescriptions;
  dictionaryDescriptions.DeleteAll();
  // Create user dictionary description and add it to the collection
  IDictionaryDescription dictionaryDescription = dictionaryDescriptions.AddNew( DictionaryTypeEnum.DT_UserDictionary );
  IUserDictionaryDescription userDictionaryDescription = dictionaryDescription.GetAsUserDictionaryDescription();
  userDictionaryDescription.FileName = dictionaryFileName;
  ```
</Accordion>

The object is used in the following code samples in Linux and Windows: [CustomLanguage](/fine-reader/engine/guided-tour/samples#customlanguage).

## See also

[UserDictionaryDescription](/fine-reader/engine/api-reference/language-related-objects/userdictionarydescription)

[Working with Dictionaries](/fine-reader/engine/guided-tour/advanced-techniques/working-with-dictionaries)

[Working with Properties](/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties)
