次の方法で共有


RecognitionResult.TopConfidence プロパティ

RecognitionResult オブジェクトの TopAlternate プロパティの信頼性レベルを取得します。

名前空間 :  Microsoft.Ink
アセンブリ :  Microsoft.Ink (Microsoft.Ink.dll 内)

構文

'宣言
Public ReadOnly Property TopConfidence As RecognitionConfidence
'使用
Dim instance As RecognitionResult
Dim value As RecognitionConfidence

value = instance.TopConfidence
public RecognitionConfidence TopConfidence { get; }
public:
property RecognitionConfidence TopConfidence {
    RecognitionConfidence get ();
}
/** @property */
public RecognitionConfidence get_TopConfidence()
public function get TopConfidence () : RecognitionConfidence

プロパティ値

型 : Microsoft.Ink.RecognitionConfidence
RecognitionResult オブジェクトの TopAlternate プロパティの信頼性レベル。

解説

Microsoft® の認識エンジンの場合、Microsoft 英語 (米国) 手書き認識エンジンと Microsoft ジェスチャ認識エンジンだけが信頼性レベルをサポートします。サード パーティの認識エンジンは、信頼性レベルをサポートしている場合とサポートしていない場合があります。

この例では、メニュー項目やボタンのクリックといったユーザーの操作に対応して同期認識が処理されます。まず、RecognizerContext オブジェクトの Strokes コレクションが、InkOverlay オブジェクトに関連付けられた Strokes コレクションから割り当てられ、ストロークの数がチェックされます。Strokes コレクションに少なくとも 1 つの Stroke オブジェクトが含まれる場合、Recognize メソッドの呼び出しにより認識処理が開始されます。認識に成功し、TopConfidence (サポートされている場合) が RecognitionConfidencePoor ではない (つまり Intermediate または Strong である) 場合、TopString がリスト ボックスに追加されることで表示されます。

' assign strokes collection from the collected strokes
Me.mRecognizerContext.Strokes = Me.mInkOverlay.Ink.Strokes
' check stroke count. Recognize() will throw exception if no strokes
If (Me.mRecognizerContext.Strokes.Count > 0) Then
    Dim status As RecognitionStatus
    ' perform the recognition
    Dim rResult As RecognitionResult = Me.mRecognizerContext.Recognize(status)
    ' see if the recognizer used supports confidence levels
    Dim rSupportsConfidence As Boolean = RecognizerSupportsConfidence(mRecognizerContext.Recognizer)
    ' check status and TopConfidence (if supported)
    If (RecognitionStatus.NoError = status And _
        ((rSupportsConfidence And _
         rResult.TopConfidence <> RecognitionConfidence.Poor) Or _
         Not rSupportsConfidence)) Then
        listBoxRecognitionResults.Items.Add(rResult.TopString)
    End If
End If
// assign strokes collection from the collected strokes
this.mRecognizerContext.Strokes = this.mInkOverlay.Ink.Strokes;
// check stroke count. Recognize() will throw exception if no strokes
if (this.mRecognizerContext.Strokes.Count > 0)
{
    RecognitionStatus status;
    // perform the recognition
    RecognitionResult rResult = this.mRecognizerContext.Recognize(out status);
    // see if the recognizer used supports confidence levels
    bool rSupportsConfidence = RecognizerSupportsConfidence(mRecognizerContext.Recognizer);
    // check status and TopConfidence (if supported)
    if (RecognitionStatus.NoError == status &&
        ((rSupportsConfidence &&
         rResult.TopConfidence != RecognitionConfidence.Poor) ||
         !rSupportsConfidence))
    {
        listBoxRecognitionResults.Items.Add(rResult.TopString);
    }
}

次の例では、Recognizer で信頼性のレベルがサポートされているかどうかを判断するために使用されるヘルパ メソッドを示します。

Private Function RecognizerSupportsConfidence(ByVal pRecognizer As Recognizer) As Boolean
    For Each G As Guid In pRecognizer.SupportedProperties
        If G = RecognitionProperty.ConfidenceLevel Then
            Return True
        End If
    Next
    Return False
End Function
private bool RecognizerSupportsConfidence(Recognizer pRecognizer)
{
    foreach (Guid G in pRecognizer.SupportedProperties)
    {
        if (G == RecognitionProperty.ConfidenceLevel)
        {
            return true;
        }
    }
    return false;
}

プラットフォーム

Windows Vista

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

RecognitionResult クラス

RecognitionResult メンバ

Microsoft.Ink 名前空間

RecognitionConfidence

RecognitionResult.TopAlternate