Bagikan melalui


RecognizerContext.WordList Property

RecognizerContext.WordList Property

Gets or sets the WordList object that is used to improve the recognition results.

Definition

Visual Basic .NET Public Property WordList As WordList
C# public WordList WordList { get; set; }
Managed C++ public: __property WordList* get_WordList();
public: __property void set_WordList(WordList*);

Property Value

Microsoft.Ink.WordList. The word list that is used to improve the recognition results.

This property is read/write. This property has no default value.

Exceptions

COMException Leave Site:
ObjectDisposedException Leave Site:

Remarks

For the WordList property, the value null refers to the user dictionary.

Setting the WordList property succeeds only if the Strokes property is null. You must set the WordList property before you attach a Strokes collection to the Strokes property of the RecognizerContext, or you must set the Strokes property to null and then set the WordList property.

Note: If you use the latter method, you may need to reattach the Strokes collection to the Strokes property of the RecognizerContext object.

To remove the current word list and use the user dictionary, set the WordList property to null. Any subsequent modification of the WordList object does not modify the recognition outcome. If you want to change the word list later, change it and then reassign the WordList property.

Use the Factoid property to limit the search to the word list that is associated with the context. You may also need to set the RecognitionFlags property to improve the results.

If a string is added to a word list, its capitalized versions are also implicitly added. For instance, adding "hello" implicitly adds "Hello" and "HELLO".

Examples

[C#]

This C# example creates a WordList object from a StringCollection Leave Site, theUserDictionary, then merges it into the WordList property of the RecognizerContext object, theRecognizerContext.

using System.Collections.Specialized;
using Microsoft.Ink
//...
RecognizerContext theRecognizerContext;
StringCollection theUserDictionary;
//...
// Initialize theRecognizerContext and theUserDictionary objects here.
//...
WordList theUserWordList = new WordList();
foreach (string theString in theUserDictionary)
{
   theUserWordList.Add(theString);
}
theUserWordList.Merge(theRecognizerContext.WordList);
// Note: there should be no strokes in the Strokes property of the RecognizerContext
// when setting the WordList property
theRecognizerContext.WordList = theUserWordList;
//...

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example creates a WordList object from a StringCollection Leave Site, theUserDictionary, then merges it into the WordList property of the RecognizerContext object, theRecognizerContext.

Imports System.Collections.Specialized
Imports Microsoft.Ink
'...
Dim theRecognizerContext As RecognizerContext
Dim theUserDictionary As StringCollection
'...
'Initialize theRecognizerContext and theUserDictionary objects here.
'...
Dim theUserWordList As New WordList()
Dim theString As String
For Each theString In theUserDictionary
theUserWordList.Add(theString)
Next
theUserWordList.Merge(theRecognizerContext.WordList)
' Note: there should be no strokes in the Strokes property of
'       the RecognizerContext when setting the WordList property
theRecognizerContext.WordList = theUserWordList

See Also