Understanding WordLists, the RecognizerContext, and Factoids

Understanding WordLists, the RecognizerContext, and Factoids

Introduction to WordList, RecognizerContext, and Factoid classes.

All application dictionaries are implemented by using the WordList object. The RecognizerContext object manages recognition, in part through the RecognizerContext.WordList property. The RecognizerContext object passes the word list to the recognizer. You may enable an application dictionary in any recognizer context in your application by setting the WordList property of the RecognizerContext object. To make the word list available to the entire application, you must set the WordList property of every RecognizerContext object in the application.

At the recognizer level, all dictionaries except for the system dictionary are implemented as word lists. However, the recognizer can only have one active word list at a time. This means that you cannot have both an application dictionary and the user dictionary active at the same time. On the other hand, the system dictionary is always available, unless a factoid is set that turns the system dictionary off.

The user dictionary is the list of words that the user has added to their Tablet PC. If the WordList property of the RecognizerContext is not set, the RecognizerContext passes the user dictionary as a word list to the recognizer. However, if the WordList property of the RecognizerContext object is set, the word list is passed to the recognizer instead of the user dictionary.

Note: The Strokes property of the RecognizerContext object must be empty before you set the WordList property. If the Strokes property is not empty, an exception is thrown. Words should never be added to a word list after it has been assigned to a RecognizerContext object.

Setting a factoid on the RecognizerContext object also affects how application dictionaries are used by the recognizer. The factoids that affect the behavior of dictionaries are:

By far, the most useful factoid for application dictionaries is the WordList factoid. The WordList factoid biases the recognizer towards returning only words found in the world list. This factoid turns off all other dictionaries except for the word list. If the WordList factoid is set, and no word list is specified in the recognizer context, the user dictionary is used as the word list.

For example, if you are designing an airplane parts application with a field that accepts one of ten names of specialized parts, you may create a word list that contains only these part names. Setting the WordList factoid for the field greatly improves recognition for the words entered in that field. The recognizer need not choose between words in the system dictionary and words in the word list.

The SystemDictionary factoid enables the system dictionary only. The None factoid disables all dictionaries. These two factoids are used to increase recognition accuracy in certain instances. However, because they disable application dictionaries, they are rarely used in conjunction with application dictionaries.

For more information about how factoids affect recognition, see Improving Tablet PC Recognition Accuracy by Setting Context.

For more information about the SystemDictionary and None factoids, see Supported Factoids from Version 1.