다음을 통해 공유


RecognizerContext.WordList Property

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

Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)

Syntax

'Declaration
Public Property WordList As WordList
'Usage
Dim instance As RecognizerContext
Dim value As WordList

value = instance.WordList

instance.WordList = value
public WordList WordList { get; set; }
public:
property WordList^ WordList {
    WordList^ get ();
    void set (WordList^ value);
}
/** @property */
public WordList get_WordList ()

/** @property */
public void set_WordList (WordList value)
public function get WordList () : WordList

public function set WordList (value : WordList)
Not applicable.

Property Value

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

Remarks

For the WordList property, the value a null reference (Nothing in Visual Basic) refers to the user dictionary.

Setting the WordList property succeeds only if the Strokes property is a null reference (Nothing in Visual Basic). 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 a null reference (Nothing in Visual Basic) 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 a null reference (Nothing in Visual Basic). Any subsequent modification of the WordList object does not modify the recognition outcome.

Re-assigning the same WordList object with modified content does not replace previous WordList - it only adds the delta to the existing WordList. Two techniques exist to achieve this result:

  1. Create a new RecognizerContext object and assign the modified WordList to it.

  2. Create a new WordList object and assign to the existing RecognizerContext.

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.

Wordlist cannot be set after a factoid is set. This prevents a factoid from referring to a possibly non existent wordlist. Attempting to do so will result in the following COM exception: "The method was called after Process has been called or Factoid has been set".

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".

To clear the WordList, set it equal to an empty WordList object.

Example

This C# example creates a WordList object from a StringCollection, 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;
//...

This Microsoft® Visual Basic® .NET example creates a WordList object from a StringCollection, 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

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

RecognizerContext Class
RecognizerContext Members
Microsoft.Ink Namespace
WordList
RecognizerContext.Strokes
RecognizerContext.Factoid
RecognizerContext.RecognitionFlags