RecognizedWordUnit.Text 속성

정의

인식된 단어의 정규화된 텍스트를 가져옵니다.

public:
 property System::String ^ Text { System::String ^ get(); };
public string Text { get; }
member this.Text : string
Public ReadOnly Property Text As String

속성 값

String

주어진 입력 단어에 대한 표준화 된 텍스트 출력을 포함하고 있는 문자열

예제

다음 예제에서는 세 가지 형식 중 하나에서 문자열을 생성 하는 유틸리티 루틴: 어휘 (사용 하 여 LexicalForm), 정규화 된 (사용 하 여 Text), 음성 및 (사용 하 여 Pronunciation). 텍스트 출력에서 가져온를 ReadOnlyCollection<T>RecognizedWordUnit 에서 가져온 개체는 Words 속성에는 RecognizedPhrase 개체입니다.

internal enum WordType   
{  
  Text,  
  Normalized = Text,  
  Lexical,  
  Pronunciation  
}  
internal static string stringFromWordArray(  
          ReadOnlyCollection<RecognizedWordUnit> words,   
          WordType type)   
{  
  string text = "";  
  foreach (RecognizedWordUnit word in words)   
  {  
    string wordText = "";  
    if (type == WordType.Text || type == WordType.Normalized)   
    {  
      wordText = word.Text;  
    }   
    else if (type == WordType.Lexical)   
    {  
      wordText = word.LexicalForm;  
    }   
    else if (type == WordType.Pronunciation)   
    {  
      wordText = word.Pronunciation;  
    }   
    else   
    {  
      throw new InvalidEnumArgumentException(  
           String.Format("[0}: is not a valid input", type));  
    }  

    // Use display attribute  
    if ((word.DisplayAttributes & DisplayAttributes.OneTrailingSpace) != 0)   
    {  
      wordText += " ";  
    }  
    if ((word.DisplayAttributes & DisplayAttributes.TwoTrailingSpaces) != 0)   
    {  
      wordText += "  ";  
    }  
    if ((word.DisplayAttributes & DisplayAttributes.ConsumeLeadingSpaces) != 0)   
    {  
      wordText = wordText.TrimStart();  
    }  
    if ((word.DisplayAttributes & DisplayAttributes.ZeroTrailingSpaces) != 0)   
    {  
      wordText = wordText.TrimEnd();  
    }  

    text += wordText;  

  }  
  return text;  
}  

설명

대부분의 경우 반환 값 TextLexicalForm 동일 하 게 됩니다. 그러나 인식 엔진은 보다 친숙 한 또는 colloquial의 텍스트 표현을 오디오 입력을 반환할 음성 정규화를 사용할 수 있습니다.

음성 표준화는 특수 구문 또는 기호에에서 음성 express를 사용 합니다. 예를 들어 정규화 "$1.16" 출력 텍스트에서를 사용 하 여 "달러 및 16 센트" 음성된 단어를 바꿀 수 있습니다.

적용 대상