Aracılığıyla paylaş


GrammarBuilder.Add Yöntem

Tanım

İki dil bilgisi öğesi dizisi içeren yeni GrammarBuilder bir oluşturur.

Aşırı Yüklemeler

Add(Choices, GrammarBuilder)

Bir nesne ve ardından bir Choices nesne içeren yeni GrammarBuilder bir GrammarBuilder oluşturur.

Add(GrammarBuilder, Choices)

Bir nesne ve ardından bir GrammarBuilder nesne içeren yeni GrammarBuilder bir Choices oluşturur.

Add(GrammarBuilder, GrammarBuilder)

İki GrammarBuilder nesneden oluşan bir dizi içeren yeni GrammarBuilder bir oluşturur.

Add(GrammarBuilder, String)

Bir nesne ve ardından bir GrammarBuilder tümcecik içeren yeni GrammarBuilder bir oluşturur.

Add(String, GrammarBuilder)

Bir tümcecik ve ardından bir nesne içeren yeni GrammarBuilder bir GrammarBuilder oluşturur.

Açıklamalar

Statik Add yöntemler, ile GrammarBuilderoluşturulan dil bilgilerinde çeşitlilik ve esneklik oluşturmak için çeşitli türleri birleştirebileceğiniz başka bir mekanizma sağlar. Bu yöntemler, sınıfında da tanımlanan statik Addition yöntemlere GrammarBuilder karşılık gelir. Parametrelerin sırası, yeni GrammarBuilderiçindeki öğelerin sırasını belirler.

, GrammarBuilder , SemanticResultKeySemanticResultValueve String nesnelerinden Choicesde bir elde edilebilir. Daha fazla bilgi için bkz Implicit . ve Addition işleçleri.

Önemli

Konuşma tanıyıcı, aynı anahtar adına sahip yinelenen semantik öğeler veya aynı semantik öğenin değerini tekrar tekrar değiştirebilen birden çok semantik öğe içeren bir konuşma tanıma dil bilgisi kullanırken özel durum oluşturabilir.

Konuşma tanıma dil bilgisi oluşturma ve kullanma hakkında daha fazla bilgi için bkz . Konuşma Tanıma.

Add(Choices, GrammarBuilder)

Kaynak:
GrammarBuilder.cs
Kaynak:
GrammarBuilder.cs
Kaynak:
GrammarBuilder.cs

Bir nesne ve ardından bir Choices nesne içeren yeni GrammarBuilder bir GrammarBuilder oluşturur.

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

Parametreler

choices
Choices

Bir dizi alternatifi temsil eden ilk dil bilgisi öğesi.

builder
GrammarBuilder

İkinci dil bilgisi öğesi.

Döndürülenler

GrammarBuilder Öğesinin dizisi choices ve ardından öğesi için Abuilder.

Açıklamalar

GrammarBuilder aşağıdaki sınıflardan örtük dönüştürmeleri destekler:

Bu yöntem, parametresi için builder yukarıda listelenen nesneleri kabul eder.

Daha fazla bilgi için bkz Implicit . ve Addition işleçleri.

Önemli

veya SemanticResultKey içeren nesneleri birleştirdiğinizde GrammarBuilderChoices, aynı anahtar adına sahip yinelenen semantik öğeler veya bir SemanticValue nesnenin özelliğini tekrar tekrar değiştirebilecek Value birden çok semantik öğe oluşturmaktan SemanticResultValue kaçının. Konuşma tanıyıcı, bu durumlarla karşılaşırsa bir özel durum oluşturabilir. Anlam bilgisi içeren bir konuşma tanıma dil bilgisi oluşturma hakkında daha fazla bilgi için bkz. GrammarBuilder Dilbilgisine Semantik Ekleme.

Ayrıca bkz.

Şunlara uygulanır

Add(GrammarBuilder, Choices)

Kaynak:
GrammarBuilder.cs
Kaynak:
GrammarBuilder.cs
Kaynak:
GrammarBuilder.cs

Bir nesne ve ardından bir GrammarBuilder nesne içeren yeni GrammarBuilder bir Choices oluşturur.

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

Parametreler

builder
GrammarBuilder

İlk dil bilgisi öğesi.

choices
Choices

Bir dizi alternatifi temsil eden ikinci dil bilgisi öğesi.

Döndürülenler

GrammarBuilder Öğesinin dizisi builder ve ardından öğesi için Achoices.

Örnekler

Aşağıdaki örnek, bir dizi renk arasından rengin seçildiği "Arka plan rengi yap" ve "Arka planı renge ayarla" ifadelerini tanıyabilen bir konuşma tanıma dil bilgisi oluşturur. DizeChoices, ve GrammarBuilder nesneleri gibi son dil bilgisini oluşturmak için çeşitli türler kullanılır. Yöntemlere Add yapılan çağrılardaki açık atama işleçleri isteğe bağlıdır.

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;
}

Açıklamalar

GrammarBuilder aşağıdaki sınıflardan örtük dönüştürmeleri destekler:

Bu yöntem, parametresi için builder yukarıda listelenen nesneleri kabul eder.

Daha fazla bilgi için bkz Implicit . ve Addition işleçleri.

Önemli

veya içeren nesneleri diğer SemanticResultKey dil bilgisi öğeleriyle birleştirdiğinizde ChoicesGrammarBuilder, aynı anahtar adına sahip yinelenen semantik öğeler veya bir SemanticValue nesnenin özelliğini tekrar tekrar değiştirebilecek Value birden çok semantik öğe oluşturmaktan kaçının.SemanticResultValue Konuşma tanıyıcı, bu durumlarla karşılaşırsa bir özel durum oluşturabilir.

Ayrıca bkz.

Şunlara uygulanır

Add(GrammarBuilder, GrammarBuilder)

Kaynak:
GrammarBuilder.cs
Kaynak:
GrammarBuilder.cs
Kaynak:
GrammarBuilder.cs

İki GrammarBuilder nesneden oluşan bir dizi içeren yeni GrammarBuilder bir oluşturur.

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

Parametreler

builder1
GrammarBuilder

İlk dil bilgisi öğesi.

builder2
GrammarBuilder

İkinci dil bilgisi öğesi.

Döndürülenler

GrammarBuilder Öğesinin dizisi builder1 ve ardından öğesi için Abuilder2.

Örnekler

Aşağıdaki örnek, bir dizi renk arasından rengin seçildiği "Arka plan rengi yap" ve "Arka planı renge ayarla" ifadelerini tanıyabilen bir konuşma tanıma dil bilgisi oluşturur. DizeChoices, ve GrammarBuilder nesneleri gibi son dil bilgisini oluşturmak için çeşitli türler kullanılır. Yöntemlere Add yapılan çağrılardaki açık atama işleçleri isteğe bağlıdır.

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;
}

Açıklamalar

GrammarBuilder aşağıdaki sınıflardan örtük dönüştürmeleri destekler:

Bu yöntem, veya builder2 parametresi için builder1 yukarıda listelenen nesneleri kabul eder.

Daha fazla bilgi için bkz Implicit . ve Addition işleçleri.

Önemli

veya içeren nesneleri diğer SemanticResultKey dil bilgisi öğeleriyle birleştirdiğinizde ChoicesGrammarBuilder, aynı anahtar adına sahip yinelenen semantik öğeler veya bir SemanticValue nesnenin özelliğini tekrar tekrar değiştirebilecek Value birden çok semantik öğe oluşturmaktan kaçının.SemanticResultValue Konuşma tanıyıcı, bu durumlarla karşılaşırsa bir özel durum oluşturabilir.

Ayrıca bkz.

Şunlara uygulanır

Add(GrammarBuilder, String)

Kaynak:
GrammarBuilder.cs
Kaynak:
GrammarBuilder.cs
Kaynak:
GrammarBuilder.cs

Bir nesne ve ardından bir GrammarBuilder tümcecik içeren yeni GrammarBuilder bir oluşturur.

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

Parametreler

builder
GrammarBuilder

İlk dil bilgisi öğesi.

phrase
String

Bir sözcük dizisini temsil eden ikinci dil bilgisi öğesi.

Döndürülenler

GrammarBuilder Öğesinin dizisi builder ve ardından öğesi için Aphrase.

Örnekler

Aşağıdaki örnek, bir dizi renk arasından rengin seçildiği "Arka plan rengi yap" ve "Arka planı renge ayarla" ifadelerini tanıyabilen bir konuşma tanıma dil bilgisi oluşturur. DizeChoices, ve GrammarBuilder nesneleri gibi son dil bilgisini oluşturmak için çeşitli türler kullanılır. Yöntemlere Add yapılan çağrılardaki açık atama işleçleri isteğe bağlıdır.

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;
}

Açıklamalar

GrammarBuilder aşağıdaki sınıflardan örtük dönüştürmeleri destekler:

Bu yöntem, parametresi için builder yukarıda listelenen nesneleri kabul eder.

Daha fazla bilgi için bkz Implicit . ve Addition işleçleri.

Ayrıca bkz.

Şunlara uygulanır

Add(String, GrammarBuilder)

Kaynak:
GrammarBuilder.cs
Kaynak:
GrammarBuilder.cs
Kaynak:
GrammarBuilder.cs

Bir tümcecik ve ardından bir nesne içeren yeni GrammarBuilder bir GrammarBuilder oluşturur.

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

Parametreler

phrase
String

Bir sözcük dizisini temsil eden ilk dil bilgisi öğesi.

builder
GrammarBuilder

İkinci dil bilgisi öğesi.

Döndürülenler

GrammarBuilder Öğesinin dizisi phrase ve ardından öğesi için Abuilder.

Örnekler

Aşağıdaki örnek, bir dizi renk arasından rengin seçildiği "Arka plan rengi yap" ve "Arka planı renge ayarla" ifadelerini tanıyabilen bir konuşma tanıma dil bilgisi oluşturur. DizeChoices, ve GrammarBuilder nesneleri gibi son dil bilgisini oluşturmak için çeşitli türler kullanılır. Yöntemlere Add yapılan çağrılardaki açık atama işleçleri isteğe bağlıdır.

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;
}

Açıklamalar

GrammarBuilder aşağıdaki sınıflardan örtük dönüştürmeleri destekler:

Bu yöntem, parametresi için builder yukarıda listelenen nesneleri kabul eder.

Daha fazla bilgi için bkz Implicit . ve Addition işleçleri.

Ayrıca bkz.

Şunlara uygulanır