RecognizedWordUnit.Text 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
인식된 단어의 정규화된 텍스트를 가져옵니다.
public:
property System::String ^ Text { System::String ^ get(); };
public string Text { get; }
member this.Text : string
Public ReadOnly Property Text As String
속성 값
지정된 입력 단어에 대한 정규화된 텍스트 출력을 포함하는 문자열입니다.
예제
다음 예제에서는 어휘(사용), 정규화Text(사용), 윗주(사용LexicalFormPronunciation) 등 세 가지 형식 중 하나로 문자열을 생성하는 유틸리티 루틴을 보여 줍니다. 텍스트 출력은 개체의 RecognizedWordUnit 속성 RecognizedPhrase 에서 가져온 개체에서 Words 가져옵니다ReadOnlyCollection<T>.
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;
}
설명
대부분의 경우 값이 반환 Text 되며 LexicalForm 동일합니다. 그러나 인식 엔진은 음성 정규화를 사용하여 오디오 입력의 사용자 친화적이거나 구어체 텍스트 표현을 반환할 수 있습니다.
음성 정규화는 특수 구문 또는 기호를 사용하여 음성을 서면으로 표현하는 것입니다. 예를 들어 정규화는 출력 텍스트에서 "1달러 및 16센트"라는 음성 단어를 "$1.16"으로 바꿀 수 있습니다.