SrgsText 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
W3C(월드 와이드 웹 컨소시엄) Speech Recognition Grammar Specification(SRGS) 버전 1.0에 의해 정의된 문법 요소의 텍스트 내용을 나타냅니다.
public ref class SrgsText : System::Speech::Recognition::SrgsGrammar::SrgsElement
[System.Serializable]
public class SrgsText : System.Speech.Recognition.SrgsGrammar.SrgsElement
[<System.Serializable>]
type SrgsText = class
inherit SrgsElement
Public Class SrgsText
Inherits SrgsElement
- 상속
- 특성
예제
다음 C# 코드 예제를 사용 하는 방법에 설명 합니다 SrgsText 개체의 텍스트 콘텐츠를 수정 하는 클래스입니다. SrgsItem 이 예제에서는 개체의 초기 텍스트 SrgsItem Large 값(, Larger 및 Largest )을 Small 각각 , 및 로 Medium Large 변경합니다.
// Create SrgsItem objects and specify their text.
SrgsItem smallItem = new SrgsItem("Large");
SrgsItem mediumItem = new SrgsItem("Larger");
SrgsItem largeItem = new SrgsItem("Largest");
SrgsText textOfItem = null;
// Change the text of smallItem.
if (smallItem.Elements[0] is SrgsText)
{
textOfItem = smallItem.Elements[0] as SrgsText;
textOfItem.Text = "Small";
}
// Change the text of mediumItem.
if (mediumItem.Elements[0] is SrgsText)
{
textOfItem = mediumItem.Elements[0] as SrgsText;
textOfItem.Text = "Medium";
}
// Change the text of largeItem.
if (largeItem.Elements[0] is SrgsText)
{
textOfItem = largeItem.Elements[0] as SrgsText;
textOfItem.Text = "Large";
}
// Create an SrgsOneOf object and add smallItem, mediumItem,
// and largeItem as alternatives.
SrgsOneOf itemSize = new SrgsOneOf(new SrgsItem[]
{ smallItem, mediumItem, largeItem });
// Create a new SrgsRule from the SrgsOneOf object, and specify its identifier.
SrgsRule size = new SrgsRule("Sizes", itemSize);
// Create an SrgsDocument object.
// Add the SrgsRule object to the collection of rules and make it the root rule.
SrgsDocument document = new SrgsDocument();
document.Rules.Add(size);
document.Root = size;
// Write the SrgsDocument to an XML grammar file.
string srgsDocumentFile = Path.Combine(Path.GetTempPath(), "srgsDocumentFile.xml");
XmlWriter writer = XmlWriter.Create(srgsDocumentFile);
document.WriteSrgs(writer);
writer.Close();
다음은 개체의 수정된 텍스트가 SrgsItem 출력 XML 문법 파일의 요소로 표시되는 방법을 item 보여줍니다.
<!-- SRGS XML Fragment -->
<one-of>
<item>Small</item>
<item>Medium</item>
<item>Large</item>
</one-of>
설명
SrgsText클래스는 SRGS 요소 태그 집합 내에 있는 텍스트를 나타냅니다. SrgsItem개체가 매개 변수를 사용하여 생성되면 해당 String SrgsText 매개 Text 변수의 값으로 초기화된 해당 속성을 사용하여 개체가 만들어집니다. Text그런 다음 개체가 개체의 Elements 컬렉션에 SrgsItem 추가됩니다.
생성자
| SrgsText() |
SrgsText 클래스의 새 인스턴스를 초기화합니다. |
| SrgsText(String) |
인스턴스의 텍스트를 지정하여 SrgsText 클래스의 새 인스턴스를 초기화합니다. |
속성
| Text |
SrgsText 클래스 인스턴스 내에 포함된 텍스트를 가져오거나 설정합니다. |
메서드
| CreateObjRef(Type) |
원격 개체와 통신하는 데 사용되는 프록시 생성에 필요한 모든 관련 정보가 들어 있는 개체를 만듭니다. (다음에서 상속됨 MarshalByRefObject) |
| Equals(Object) |
지정된 개체가 현재 개체와 같은지 확인합니다. (다음에서 상속됨 Object) |
| GetHashCode() |
기본 해시 함수로 작동합니다. (다음에서 상속됨 Object) |
| GetLifetimeService() |
사용되지 않습니다.
이 인스턴스의 수명 정책을 제어하는 현재의 수명 서비스 개체를 검색합니다. (다음에서 상속됨 MarshalByRefObject) |
| GetType() |
현재 인스턴스의 Type을 가져옵니다. (다음에서 상속됨 Object) |
| InitializeLifetimeService() |
사용되지 않습니다.
이 인스턴스의 수명 정책을 제어하는 수명 서비스 개체를 가져옵니다. (다음에서 상속됨 MarshalByRefObject) |
| MemberwiseClone() |
현재 Object의 단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
| MemberwiseClone(Boolean) |
현재 MarshalByRefObject 개체의 단순 복사본을 만듭니다. (다음에서 상속됨 MarshalByRefObject) |
| ToString() |
현재 개체를 나타내는 문자열을 반환합니다. (다음에서 상속됨 Object) |