共用方式為


RecognizedPhrase.Confidence 屬性

定義

取得辨識器指派的值,這個值表示 RecognizedPhrase 符合指定之輸入的可能性。

public:
 property float Confidence { float get(); };
public float Confidence { get; }
member this.Confidence : single
Public ReadOnly Property Confidence As Single

屬性值

正確辨識片語的確定性相對量值。 此值介於 0.0 到 1.0,分別表示低度到高度的信賴值。

範例

下列範例顯示 、 SpeechRecognizer.SpeechRecognizedGrammar.SpeechRecognized 事件的處理常式 SpeechRecognitionEngine.SpeechRecognized 。 此範例顯示與 RecognitionResult 物件相關聯的資訊,其中部分衍生自 RecognizedPhrase 。 處理常式會顯示已辨識片語的信賴分數,以及辨識替代專案。

void SpeechRecognizedHandler(object sender, SpeechRecognizedEventArgs e)
{
  if (e.Result == null) return;

  // Add event handler code here.

  // The following code illustrates some of the information available
  // in the recognition result.
  Console.WriteLine("Recognition result summary:");
  Console.WriteLine(
    "  Recognized phrase: {0}\n" +
    "  Confidence score {1}\n" +
    "  Grammar used: {2}\n",
    e.Result.Text, e.Result.Confidence, e.Result.Grammar.Name);

  // Display the semantic values in the recognition result.
  Console.WriteLine("  Semantic results:");
  foreach (KeyValuePair<String, SemanticValue> child in e.Result.Semantics)
  {
    Console.WriteLine("    The {0} city is {1}",
      child.Key, child.Value.Value ?? "null");
  }
  Console.WriteLine();

  // Display information about the words in the recognition result.
  Console.WriteLine("  Word summary: ");
  foreach (RecognizedWordUnit word in e.Result.Words)
  {
    Console.WriteLine(
      "    Lexical form ({1})" +
      " Pronunciation ({0})" +
      " Display form ({2})",
      word.Pronunciation, word.LexicalForm, word.DisplayAttributes);
  }

  // Display information about the audio in the recognition result.
  Console.WriteLine("  Input audio summary:\n" +
    "    Candidate Phrase at:       {0} mSec\n" +
    "    Phrase Length:             {1} mSec\n" +
    "    Input State Time:          {2}\n" +
    "    Input Format:              {3}\n",
    e.Result.Audio.AudioPosition,
    e.Result.Audio.Duration,
    e.Result.Audio.StartTime,
    e.Result.Audio.Format.EncodingFormat);

  // Display information about the alternate recognitions in the recognition result.
  Console.WriteLine("  Alternate phrase collection:");
  foreach (RecognizedPhrase phrase in e.Result.Alternates)
  {
    Console.WriteLine("    Phrase: " + phrase.Text);
    Console.WriteLine("    Confidence score: " + phrase.Confidence);
  }
}

備註

信賴分數不會指出片語正確辨識的絕對可能性。 相反地,信賴分數會提供一種機制,以比較指定輸入之多個辨識替代專案的相對精確度。 這有助於傳回最精確的辨識結果。 例如,如果辨識的片語信賴分數為 0.8,這並不表示片語有 80% 的機會是輸入的正確相符專案。 這表示片語比起其他信賴分數小於 0.8 的結果,更可能符合輸入的正確比對。

除非您有要與相同辨識作業或先前相同輸入辨識進行比較的替代結果,否則信賴分數本身並不有意義。 這些值是用來排列 物件上 RecognitionResult 屬性所 Alternates 傳回的替代候選片語。

信賴值是每個辨識引擎的相對和唯一值。 兩個不同辨識引擎傳回的信賴值無法有意義地進行比較。

語音辨識引擎可能會基於各種原因,將低信賴分數指派給口語輸入,包括背景干擾、無預測語音或非預期的單字或字序列。 如果您的應用程式使用 SpeechRecognitionEngine 實例,您可以使用其中 UpdateRecognizerSetting 一種方法來修改接受或拒絕語音輸入的信賴等級。 由 管理的 SpeechRecognizer 共用辨識器信賴臨界值會與使用者設定檔相關聯,並儲存在 Windows 登錄中。 應用程式不應該為共用辨識器的屬性,將變更寫入登錄。

物件的 Alternates 屬性 RecognitionResult 包含物件的已排序集合 RecognizedPhrase ,每個物件都是辨識器輸入的可能相符專案。 替代專案會從最高到最低信賴度排序。

適用於

另請參閱