Share via


SrgsToken.Pronunciation 속성

정의

토크에 대한 발음을 정의하는 문자열을 가져오거나 설정합니다.

public:
 property System::String ^ Pronunciation { System::String ^ get(); void set(System::String ^ value); };
public string Pronunciation { get; set; }
member this.Pronunciation : string with get, set
Public Property Pronunciation As String

속성 값

PhoneticAlphabet에서 정해진 음성 알파벳으로부터 문자열을 포함하는 폰을 반환합니다.

예외

Pronunciationnull로 설정하려고 한 경우

Pronunciation에 공백 문자열 할당이 시도됩니다.

예제

다음 예제에서는 문법을 속어 단어를 포함 및 일반적이 지 않은 단어를 역시: "whatchamacallit"입니다. 사용 하 여 사용자 지정 인라인 발음을 추가 합니다 Pronunciation 의 속성을 SrgsToken 클래스 "whatchamacallit"도 포함 하는 전체 구가와 word에 대 한 인식 정확도 향상 시킬 수 있습니다. 휴대폰에서 Microsoft Universal Phone 설정 (UPS)를 사용 하 여 사용자 정의 발음을 정의 하는 예제입니다.

using System;
using System.Speech.Recognition;
using System.Speech.Recognition.SrgsGrammar;

namespace SampleRecognition
{
  class Program
  {
    static void Main(string[] args)

    // Initialize an instance of the in-process recognizer.
    {
      using (SpeechRecognitionEngine recognizer =
         new SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-US")))
      {

        // Build the SrgsOneOf objects with alternative choices for the slang phrase.
        SrgsOneOf gimme = new SrgsOneOf(
          new string[] { "give me", "gimme", "hand me", "ha'me" });
        SrgsOneOf the = new SrgsOneOf(new string[] { "the", "duh" });

        // Build the one-of element that contains the pronunciation.
        SrgsItem thing = new SrgsItem("thingamajig");
        SrgsItem whatcha = new SrgsItem();
        SrgsToken callit = new SrgsToken("whatchamacallit");
        callit.Pronunciation = "W AE T CH AE M AE K AA L IH T";
        whatcha.Add(callit);
        SrgsOneOf what = new SrgsOneOf(new SrgsItem[] {thing, whatcha});

        // Create the rule from the SrgsOneOf objects.
        SrgsRule slangRule = new SrgsRule("slang", gimme, the, what);

        // Build an SrgsDocument object from the rule and set the phonetic alphabet.
        SrgsDocument tokenPron = new SrgsDocument(slangRule);
        tokenPron.PhoneticAlphabet = SrgsPhoneticAlphabet.Ups;

        // Create a Grammar object from the SrgsDocument and load it to the recognizer.
        Grammar g_Slang = new Grammar(tokenPron);
        g_Slang.Name = ("Slang Pronunciation");
        recognizer.LoadGrammarAsync(g_Slang);

        // Configure recognizer input.
        recognizer.SetInputToDefaultAudioDevice();

        // Attach a handler for the SpeechRecognized event.
        recognizer.SpeechRecognized +=
          new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized);

        // Start asynchronous recognition.
        recognizer.RecognizeAsync();
        Console.WriteLine("Starting asynchronous recognition...");

        // Keep the console window open.
        Console.ReadLine();
      }
    }

    // Handle the SpeechRecognized event.
    static void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
    {
      Console.WriteLine("Recognized phrase: " + e.Result.Text);
      Console.WriteLine("Confidence: " + e.Result.Confidence);
      Console.WriteLine("  Word summary: ");
      foreach (RecognizedWordUnit word in e.Result.Words)
      {
        Console.WriteLine(
          "    Lexical form ({1})" +
          " Pronunciation ({0})" +
          " Confidence ({2})",
          word.Pronunciation, word.LexicalForm, word.Confidence);
      }
    }
  }
}

설명

휴대폰은 문자 또는 음성 발음을 설명 하는 기호입니다. System.Speech 사용자 정의 발음을 지정 하기 위한 세 가지 음성 알파벳을 지원 합니다: 유니버설 전화 설정 (UPS), 음성 API (SAPI) 전화 집합 및 International Phonetic Alphabet (IPA). 에 지정 된 휴대폰 Pronunciation 에서 정해진 음성 알파벳 같아야 PhoneticAlphabet합니다. 참조 사전 및 음성 알파벳 자세한 내용은 합니다.

에 지정 된 휴대폰 Pronunciation 나타내는 방법을 내용의 Text 성공적인 인식을 위한 현저 하 게 해야 합니다. 음성 인식 엔진 사용에 지정 된 발음 Pronunciation 입력 음성 및 반환에 포함 된 문자열에 맞게 Text 인식 결과에서.

인식 엔진에 포함 된 단어의 유효한 발음으로 지정 된 발음 전화 공백으로 구분 됩니다 또는 지정된 된 문자열을 인식할 수 없는 휴대폰을 포함 하는 경우 인식 하지 못합니다 Text합니다.

에 지정 된 발음 Pronunciation 발음 문법을 또는 인식 엔진에 연결 된 사전을 지정 보다 우선적으로 적용 합니다. 또한의 발음을 Pronunciation 단어나 구가 포함 된 단일 발생에만 속성이 적용 됩니다 Text합니다.

적용 대상

추가 정보