次の方法で共有


RecognizerContext.IsStringSupported Method

RecognizerContext.IsStringSupported Method

Returns a value that indicates whether the system dictionary, user dictionary, or word list contain a specified string.

Definition

Visual Basic .NET Public Function IsStringSupported( _
ByVal s As String _
) As Boolean
C# public bool IsStringSupported(
string s
);
Managed C++ public: bool* IsStringSupported(
String *s
);

Parameters

s System.String. The string to look up in the dictionaries and word list.

Return Value

System.Boolean. A value that indicates whether the system dictionary, user dictionary, or word list contain a specified string.

true The string is in the dictionary or word list
false The string is in neither the dictionary nor the word list

Exceptions

ObjectDisposedException Leave Site: The RecognizerContext object is disposed.

Remarks

This method considers all flags and factoids, among other things, that give context to the string that is being tested.

This method does not search the user dictionary if you specify a WordList property for the context. The recognizer uses the speech dictionary in Microsoft® Office 2000.

Use the Factoid property to limit the search to the system dictionary or the word list that is associated with the context. For example, to limit the search to the system dictionary, specify the SystemDictionary factoid. To improve the results, you may also need to set the RecognitionFlags property.

Examples

[C#]

This C# example uses the IsStringSupported method to query the WordList object that is used by the RecognizerContext object, theRecognizerContext, for a specific string, "thunk". If "thunk" is not in the word list, it is then added to the word list.

String theString = "thunk";
WordList theWordList = theRecognizerContext.WordList;
if (!theRecognizerContext.IsStringSupported(theString))
{
    theWordList.Add(theString);
    theRecognizerContext.WordList = theWordlist;
}

[Visual Basic .NET]

This Microsoft Visual Basic® .NET example uses the IsStringSupported method to query the WordList object that is used by the RecognizerContext object, theRecognizerContext, for a specific string, "thunk". If "thunk" is not in the word list, it is then added to the word list.

Dim theString as String
theString = "thunk"
Dim theWordList As WordList
Set theWordList = theRecognizerContext.WordList
If Not theRecognizerContext.IsStringSupported(theString) Then
    theWordList.Add(theString)
    TheRecognizerContext.WordList = theWordList
End If

See Also