GrammarBuilder.Add 메서드

정의

두 문법 요소의 시퀀스를 포함하는 새 GrammarBuilder를 만듭니다.

오버로드

Add(Choices, GrammarBuilder)

Choices 개체와 GrammarBuilder 개체를 차례로 포함하는 새 GrammarBuilder를 만듭니다.

Add(GrammarBuilder, Choices)

GrammarBuilder 개체와 Choices 개체를 차례로 포함하는 새 GrammarBuilder를 만듭니다.

Add(GrammarBuilder, GrammarBuilder)

GrammarBuilder 개체의 시퀀스를 포함하는 새 GrammarBuilder를 만듭니다.

Add(GrammarBuilder, String)

GrammarBuilder 개체와 그 뒤에 구를 포함하는 새 GrammarBuilder를 만듭니다.

Add(String, GrammarBuilder)

구와 그 뒤에 GrammarBuilder 개체를 포함하는 새 GrammarBuilder를 만듭니다.

설명

정적 Add 메서드는 다양성을 만드는 다양 한 형식을 결합할 수 있습니다 하 고 유연 하 게 문법 사용 하 여 빌드한 다른 메커니즘을 제공 GrammarBuilder합니다. 이러한 메서드는 정적 해당 Addition 에서도 정의 되는 메서드는 GrammarBuilder 클래스입니다. 새 요소의 순서를 결정 하는 매개 변수의 순서 GrammarBuilder합니다.

A GrammarBuilder 에서 가져올 수도 있습니다 ChoicesSemanticResultKeySemanticResultValue, 및 문자열 개체입니다. 자세한 내용은 참조는 ImplicitAddition 연산자입니다.

중요

음성 인식기 키 이름이 같은 중복 된 의미 체계 요소 또는 동일한 의미 체계 요소의 값을 반복적으로 수정할 수 있는 여러 의미 체계 요소가 포함 된 음성 인식 문법을 사용 하는 경우 예외가 throw 할 수 있습니다.

음성 인식 문법 작성 및 사용에 대 한 자세한 내용은 음성 인식을 참조 하세요.

Add(Choices, GrammarBuilder)

Choices 개체와 GrammarBuilder 개체를 차례로 포함하는 새 GrammarBuilder를 만듭니다.

public:
 static System::Speech::Recognition::GrammarBuilder ^ Add(System::Speech::Recognition::Choices ^ choices, System::Speech::Recognition::GrammarBuilder ^ builder);
public static System.Speech.Recognition.GrammarBuilder Add (System.Speech.Recognition.Choices choices, System.Speech.Recognition.GrammarBuilder builder);
static member Add : System.Speech.Recognition.Choices * System.Speech.Recognition.GrammarBuilder -> System.Speech.Recognition.GrammarBuilder
Public Shared Function Add (choices As Choices, builder As GrammarBuilder) As GrammarBuilder

매개 변수

choices
Choices

대체 항목 집합을 나타내는 첫 번째 문법 요소입니다.

builder
GrammarBuilder

두 번째 문법 요소입니다.

반환

GrammarBuilder

choices 요소와 builder 요소 시퀀스에 대한 GrammarBuilder입니다.

설명

GrammarBuilder 다음 클래스에서 암시적 변환을 지원합니다.

이 메서드는 개체에 대해 위에 나열 된 builder 매개 변수입니다.

자세한 내용은 참조는 ImplicitAddition 연산자입니다.

중요

결합 하면 Choices 하 고 GrammarBuilder 포함 하는 개체 SemanticResultValue 또는 SemanticResultKey 인스턴스에서 동일한 키 이름 또는 반복적으로 수정할 수 있는 여러 의미 체계 요소를 사용 하 여 의미 체계는 중복 요소를 만들지 않으려면 있는지 확인 합니다 Value 의 속성을 SemanticValue 개체입니다. 이러한 상황을 발생 하는 경우 음성 인식기에서 예외를 throw 수 있습니다. 의미 체계 정보가 포함 된 음성 인식 문법을 빌드하는 방법에 대 한 자세한 내용은 참조 하십시오 GrammarBuilder 문법을 추가 의미 체계합니다.

추가 정보

적용 대상

Add(GrammarBuilder, Choices)

GrammarBuilder 개체와 Choices 개체를 차례로 포함하는 새 GrammarBuilder를 만듭니다.

public:
 static System::Speech::Recognition::GrammarBuilder ^ Add(System::Speech::Recognition::GrammarBuilder ^ builder, System::Speech::Recognition::Choices ^ choices);
public static System.Speech.Recognition.GrammarBuilder Add (System.Speech.Recognition.GrammarBuilder builder, System.Speech.Recognition.Choices choices);
static member Add : System.Speech.Recognition.GrammarBuilder * System.Speech.Recognition.Choices -> System.Speech.Recognition.GrammarBuilder
Public Shared Function Add (builder As GrammarBuilder, choices As Choices) As GrammarBuilder

매개 변수

builder
GrammarBuilder

문법 요소입니다.

choices
Choices

두 번째 문법 요소로, 대체 요소의 집합을 나타냅니다.

반환

GrammarBuilder

builder 요소와 choices 요소 시퀀스에 대한 GrammarBuilder입니다.

예제

다음 예제에서는 두 구 인식할 수 있는 음성 인식 문법을 "배경 color" 및 "백그라운드로 " 여기서 색 집합에서 선택 됩니다. 문자열,, 개체 등의 최종 문법을 빌드하는 데 사용 되는 다양 한 형식이 Choices GrammarBuilder 있습니다. 에 대 한 호출에서 명시적 캐스트 연산자는 Add 메서드는 선택 사항입니다.

private Grammar CreateColorGrammar()  
{  

  // Create a set of color choices.  
  Choices colorChoice = new Choices(new string[] {"red", "green", "blue"});  

  // Create grammar builders for the two versions of the phrase.  
  GrammarBuilder makePhrase =  
    GrammarBuilder.Add((GrammarBuilder)"Make background", colorChoice);  
  GrammarBuilder setPhrase =  
    GrammarBuilder.Add("Set background to", (GrammarBuilder)colorChoice);  

  // Create a Choices for the two alternative phrases, convert the Choices  
  // to a GrammarBuilder, and construct the grammar from the result.  
  Choices bothChoices = new Choices(new GrammarBuilder[] {makePhrase, setPhrase});  
  GrammarBuilder bothPhrases = new GrammarBuilder(bothChoices);  

  Grammar grammar = new Grammar(bothPhrases);  
  grammar.Name = "backgroundColor";  
  return grammar;  
}  

설명

GrammarBuilder 다음 클래스에서 암시적 변환을 지원합니다.

이 메서드는 개체에 대해 위에 나열 된 builder 매개 변수입니다.

자세한 내용은 참조는 ImplicitAddition 연산자입니다.

중요

결합 하면 Choices 하 고 GrammarBuilder 포함 된 개체 SemanticResultValue 또는 SemanticResultKey 다른 문법 요소를 사용 하 여 인스턴스는 동일한 키 이름 또는 의미 체계는 여러 요소를 사용 하 여 의미 체계는 중복 요소를 만들지 않으려면 있는지 확인 반복적으로 수정할 수는 Value 의 속성을 SemanticValue 개체입니다. 이러한 상황을 발생 하는 경우 음성 인식기에서 예외를 throw 수 있습니다.

추가 정보

적용 대상

Add(GrammarBuilder, GrammarBuilder)

GrammarBuilder 개체의 시퀀스를 포함하는 새 GrammarBuilder를 만듭니다.

public:
 static System::Speech::Recognition::GrammarBuilder ^ Add(System::Speech::Recognition::GrammarBuilder ^ builder1, System::Speech::Recognition::GrammarBuilder ^ builder2);
public static System.Speech.Recognition.GrammarBuilder Add (System.Speech.Recognition.GrammarBuilder builder1, System.Speech.Recognition.GrammarBuilder builder2);
static member Add : System.Speech.Recognition.GrammarBuilder * System.Speech.Recognition.GrammarBuilder -> System.Speech.Recognition.GrammarBuilder
Public Shared Function Add (builder1 As GrammarBuilder, builder2 As GrammarBuilder) As GrammarBuilder

매개 변수

builder1
GrammarBuilder

문법 요소입니다.

builder2
GrammarBuilder

두 번째 문법 요소입니다.

반환

GrammarBuilder

builder1 요소와 builder2 요소 시퀀스에 대한 GrammarBuilder입니다.

예제

다음 예제에서는 두 구 인식할 수 있는 음성 인식 문법을 "배경 color" 및 "백그라운드로 " 여기서 색 집합에서 선택 됩니다. 문자열,, 개체 등의 최종 문법을 빌드하는 데 사용 되는 다양 한 형식이 Choices GrammarBuilder 있습니다. 에 대 한 호출에서 명시적 캐스트 연산자는 Add 메서드는 선택 사항입니다.

private Grammar CreateColorGrammar()  
{  

  // Create a set of color choices.  
  Choices colorChoice = new Choices(new string[] {"red", "green", "blue"});  

  // Create grammar builders for the two versions of the phrase.  
  GrammarBuilder makePhrase =  
    GrammarBuilder.Add((GrammarBuilder)"Make background", colorChoice);  
  GrammarBuilder setPhrase =  
    GrammarBuilder.Add("Set background to", (GrammarBuilder)colorChoice);  

  // Create a Choices for the two alternative phrases, convert the Choices  
  // to a GrammarBuilder, and construct the grammar from the result.  
  Choices bothChoices = new Choices(new GrammarBuilder[] {makePhrase, setPhrase});  
  GrammarBuilder bothPhrases = new GrammarBuilder(bothChoices);  

  Grammar grammar = new Grammar(bothPhrases);  
  grammar.Name = "backgroundColor";  
  return grammar;  
}  

설명

GrammarBuilder 다음 클래스에서 암시적 변환을 지원합니다.

이 메서드는 개체에 대해 위에 나열 된 builder1 또는 builder2 매개 변수입니다.

자세한 내용은 참조는 ImplicitAddition 연산자입니다.

중요

결합 하면 Choices 하 고 GrammarBuilder 포함 된 개체 SemanticResultValue 또는 SemanticResultKey 다른 문법 요소를 사용 하 여 인스턴스는 동일한 키 이름 또는 의미 체계는 여러 요소를 사용 하 여 의미 체계는 중복 요소를 만들지 않으려면 있는지 확인 반복적으로 수정할 수는 Value 의 속성을 SemanticValue 개체입니다. 이러한 상황을 발생 하는 경우 음성 인식기에서 예외를 throw 수 있습니다.

추가 정보

적용 대상

Add(GrammarBuilder, String)

GrammarBuilder 개체와 그 뒤에 구를 포함하는 새 GrammarBuilder를 만듭니다.

public:
 static System::Speech::Recognition::GrammarBuilder ^ Add(System::Speech::Recognition::GrammarBuilder ^ builder, System::String ^ phrase);
public static System.Speech.Recognition.GrammarBuilder Add (System.Speech.Recognition.GrammarBuilder builder, string phrase);
static member Add : System.Speech.Recognition.GrammarBuilder * string -> System.Speech.Recognition.GrammarBuilder
Public Shared Function Add (builder As GrammarBuilder, phrase As String) As GrammarBuilder

매개 변수

builder
GrammarBuilder

문법 요소입니다.

phrase
String

두 번째 문법 요소로, 단어의 시퀀스를 나타냅니다.

반환

GrammarBuilder

builder 요소와 phrase 요소 시퀀스에 대한 GrammarBuilder입니다.

예제

다음 예제에서는 두 구 인식할 수 있는 음성 인식 문법을 "배경 color" 및 "백그라운드로 " 여기서 색 집합에서 선택 됩니다. 문자열,, 개체 등의 최종 문법을 빌드하는 데 사용 되는 다양 한 형식이 Choices GrammarBuilder 있습니다. 에 대 한 호출에서 명시적 캐스트 연산자는 Add 메서드는 선택 사항입니다.

private Grammar CreateColorGrammar()  
{  

  // Create a set of color choices.  
  Choices colorChoice = new Choices(new string[] {"red", "green", "blue"});  

  // Create grammar builders for the two versions of the phrase.  
  GrammarBuilder makePhrase =  
    GrammarBuilder.Add((GrammarBuilder)"Make background", colorChoice);  
  GrammarBuilder setPhrase =  
    GrammarBuilder.Add("Set background to", (GrammarBuilder)colorChoice);  

  // Create a Choices for the two alternative phrases, convert the Choices  
  // to a GrammarBuilder, and construct the grammar from the result.  
  Choices bothChoices = new Choices(new GrammarBuilder[] {makePhrase, setPhrase});  
  GrammarBuilder bothPhrases = new GrammarBuilder(bothChoices);  

  Grammar grammar = new Grammar(bothPhrases);  
  grammar.Name = "backgroundColor";  
  return grammar;  
}  

설명

GrammarBuilder 다음 클래스에서 암시적 변환을 지원합니다.

이 메서드는 개체에 대해 위에 나열 된 builder 매개 변수입니다.

자세한 내용은 참조는 ImplicitAddition 연산자입니다.

추가 정보

적용 대상

Add(String, GrammarBuilder)

구와 그 뒤에 GrammarBuilder 개체를 포함하는 새 GrammarBuilder를 만듭니다.

public:
 static System::Speech::Recognition::GrammarBuilder ^ Add(System::String ^ phrase, System::Speech::Recognition::GrammarBuilder ^ builder);
public static System.Speech.Recognition.GrammarBuilder Add (string phrase, System.Speech.Recognition.GrammarBuilder builder);
static member Add : string * System.Speech.Recognition.GrammarBuilder -> System.Speech.Recognition.GrammarBuilder
Public Shared Function Add (phrase As String, builder As GrammarBuilder) As GrammarBuilder

매개 변수

phrase
String

첫 번째 문법 요소로, 단어의 시퀀스를 나타냅니다.

builder
GrammarBuilder

두 번째 문법 요소입니다.

반환

GrammarBuilder

phrase 요소와 builder 요소 시퀀스에 대한 GrammarBuilder입니다.

예제

다음 예제에서는 두 구 인식할 수 있는 음성 인식 문법을 "배경 color" 및 "백그라운드로 " 여기서 색 집합에서 선택 됩니다. 문자열,, 개체 등의 최종 문법을 빌드하는 데 사용 되는 다양 한 형식이 Choices GrammarBuilder 있습니다. 에 대 한 호출에서 명시적 캐스트 연산자는 Add 메서드는 선택 사항입니다.

private Grammar CreateColorGrammar()  
{  

  // Create a set of color choices.  
  Choices colorChoice = new Choices(new string[] {"red", "green", "blue"});  

  // Create grammar builders for the two versions of the phrase.  
  GrammarBuilder makePhrase =  
    GrammarBuilder.Add((GrammarBuilder)"Make background", colorChoice);  
  GrammarBuilder setPhrase =  
    GrammarBuilder.Add("Set background to", (GrammarBuilder)colorChoice);  

  // Create a Choices for the two alternative phrases, convert the Choices  
  // to a GrammarBuilder, and construct the grammar from the result.  
  Choices bothChoices = new Choices(new GrammarBuilder[] {makePhrase, setPhrase});  
  GrammarBuilder bothPhrases = new GrammarBuilder(bothChoices);  

  Grammar grammar = new Grammar(bothPhrases);  
  grammar.Name = "backgroundColor";  
  return grammar;  
}  

설명

GrammarBuilder 다음 클래스에서 암시적 변환을 지원합니다.

이 메서드는 개체에 대해 위에 나열 된 builder 매개 변수입니다.

자세한 내용은 참조는 ImplicitAddition 연산자입니다.

추가 정보

적용 대상