GrammarBuilder.Implicit Operatör

Tanım

Başka bir türü değerine GrammarBuilderdönüştürür.

Aşırı Yüklemeler

Açıklamalar

Örtük dönüştürme yeni bir örneği GrammarBuilderoluşturur. Aşağıdaki sınıfların her birini öğesine GrammarBuilderdönüştürebilirsiniz.

Örtük atamaların her biri oluşturucuyu çağırmaya eşdeğerdir.

Implicit(Choices to GrammarBuilder)

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

Nesneyi nesneye ChoicesGrammarBuilder dönüştürür.

public:
 static operator System::Speech::Recognition::GrammarBuilder ^(System::Speech::Recognition::Choices ^ choices);
public static implicit operator System.Speech.Recognition.GrammarBuilder(System.Speech.Recognition.Choices choices);
static member op_Implicit : System.Speech.Recognition.Choices -> System.Speech.Recognition.GrammarBuilder
Public Shared Widening Operator CType (choices As Choices) As GrammarBuilder

Parametreler

choices
Choices

Dönüştürülecek alternatifler kümesi.

Döndürülenler

Dönüştürülen Choices nesne.

Örnekler

Aşağıdaki örnek, "evet" veya "hayır" sorusuna verilen yanıtı tanıyabilen bir konuşma tanıma dil bilgisi oluşturur. Örtük dönüştürme işleci, bir nesneden nesnenin SemanticResultValue yapımında, iki Choices nesneden Choices bir nesnenin yapımında ve nesneden SemanticResultValueGrammar bir SemanticResultKey nesnenin yapımında kullanılır.

Choices yesChoices = new Choices(new string[] {"yes", "yup", "yah"});
SemanticResultValue yesValue =
  new SemanticResultValue(yesChoices, true);

Choices noChoices = new Choices(new string[] { "no", "nope", "nah" });
SemanticResultValue noValue =
  new SemanticResultValue(noChoices, false);

SemanticResultKey yesnoKey =
  new SemanticResultKey("yesno", new Choices(new GrammarBuilder[] { yesValue, noValue }));

Grammar yesnoGrammar = new Grammar(yesnoKey);
yesnoGrammar.Name = "yesno";

Açıklamalar

Örtük dönüştürme yeni bir örneği GrammarBuilderoluşturur. Bu dönüştürme işleci çağrısı GrammarBuilder ve için belirtme choices ile alternateChoiceseşdeğerdir.

Bu işlecin eşdeğer yöntemi şudur: GrammarBuilder.GrammarBuilder(Choices)

Ayrıca bkz.

Şunlara uygulanır

Implicit(SemanticResultKey to GrammarBuilder)

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

Nesneyi nesneye SemanticResultKeyGrammarBuilder dönüştürür.

public:
 static operator System::Speech::Recognition::GrammarBuilder ^(System::Speech::Recognition::SemanticResultKey ^ semanticKey);
public static implicit operator System.Speech.Recognition.GrammarBuilder(System.Speech.Recognition.SemanticResultKey semanticKey);
static member op_Implicit : System.Speech.Recognition.SemanticResultKey -> System.Speech.Recognition.GrammarBuilder
Public Shared Widening Operator CType (semanticKey As SemanticResultKey) As GrammarBuilder

Parametreler

semanticKey
SemanticResultKey

Dönüştürülecek semantik anahtar.

Döndürülenler

Dönüştürülen SemanticResultKey nesne.

Örnekler

Aşağıdaki örnek, "evet" veya "hayır" sorusuna verilen yanıtı tanıyabilen bir konuşma tanıma dil bilgisi oluşturur. Örtük dönüştürme işleci, bir nesneden nesnenin SemanticResultValue yapımında, iki Choices nesneden Choices bir nesnenin yapımında ve nesneden SemanticResultValueGrammar bir SemanticResultKey nesnenin yapımında kullanılır.

Choices yesChoices = new Choices(new string[] {"yes", "yup", "yah"});
SemanticResultValue yesValue =
  new SemanticResultValue(yesChoices, true);

Choices noChoices = new Choices(new string[] { "no", "nope", "nah" });
SemanticResultValue noValue =
  new SemanticResultValue(noChoices, false);

SemanticResultKey yesnoKey =
  new SemanticResultKey("yesno", new Choices(new GrammarBuilder[] { yesValue, noValue }));

Grammar yesnoGrammar = new Grammar(yesnoKey);
yesnoGrammar.Name = "yesno";

Açıklamalar

Örtük dönüştürme yeni bir örneği GrammarBuilderoluşturur. Bu dönüştürme işleci çağrısı GrammarBuilder ve için belirtme semanticKey ile keyeşdeğerdir.

Bu işlecin eşdeğer yöntemi şudur: GrammarBuilder.GrammarBuilder(SemanticResultKey)

Ayrıca bkz.

Şunlara uygulanır

Implicit(SemanticResultValue to GrammarBuilder)

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

Nesneyi nesneye SemanticResultValueGrammarBuilder dönüştürür.

public:
 static operator System::Speech::Recognition::GrammarBuilder ^(System::Speech::Recognition::SemanticResultValue ^ semanticValue);
public static implicit operator System.Speech.Recognition.GrammarBuilder(System.Speech.Recognition.SemanticResultValue semanticValue);
static member op_Implicit : System.Speech.Recognition.SemanticResultValue -> System.Speech.Recognition.GrammarBuilder
Public Shared Widening Operator CType (semanticValue As SemanticResultValue) As GrammarBuilder

Parametreler

semanticValue
SemanticResultValue

Dönüştürülecek SemanticResultValue nesne.

Döndürülenler

Dönüştürülen SemanticResultValue nesne.

Örnekler

Aşağıdaki örnek, "evet" veya "hayır" sorusuna verilen yanıtı tanıyabilen bir konuşma tanıma dil bilgisi oluşturur. Örtük dönüştürme işleci, bir nesneden nesnenin SemanticResultValue yapımında, iki Choices nesneden Choicesbir nesnenin yapımında ve nesneden SemanticResultValueGrammar bir SemanticResultKey nesnenin yapımında kullanılır.

Choices yesChoices = new Choices(new string[] {"yes", "yup", "yah"});
SemanticResultValue yesValue =
  new SemanticResultValue(yesChoices, true);

Choices noChoices = new Choices(new string[] { "no", "nope", "nah" });
SemanticResultValue noValue =
  new SemanticResultValue(noChoices, false);

SemanticResultKey yesnoKey =
  new SemanticResultKey("yesno", new Choices(new GrammarBuilder[] { yesValue, noValue }));

Grammar yesnoGrammar = new Grammar(yesnoKey);
yesnoGrammar.Name = "yesno";

Açıklamalar

Örtük dönüştürme yeni bir örneği GrammarBuilderoluşturur. Bu dönüştürme işleci çağrısı GrammarBuilder ve için belirtme semanticValue ile valueeşdeğerdir.

Bu işlecin eşdeğer yöntemi şudur: GrammarBuilder.GrammarBuilder(SemanticResultValue)

Ayrıca bkz.

Şunlara uygulanır

Implicit(String to GrammarBuilder)

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

Dizeyi nesneye GrammarBuilder dönüştürür.

public:
 static operator System::Speech::Recognition::GrammarBuilder ^(System::String ^ phrase);
public static implicit operator System.Speech.Recognition.GrammarBuilder(string phrase);
static member op_Implicit : string -> System.Speech.Recognition.GrammarBuilder
Public Shared Widening Operator CType (phrase As String) As GrammarBuilder

Parametreler

phrase
String

Dönüştürülecek dize.

Döndürülenler

Dönüştürülen dize.

Örnekler

Aşağıdaki örnek, "Arka plan GrammarBuilder" veya "Arka planı Choices olarak ayarla" ifadelerinden birini tanıyabilen bir dil bilgisi oluşturmak için ve nesnelerini kullanır.

Bir nesne kullanarak Choices için kabul edilebilir değerlerin listesini oluşturduktan sonra, örnek dize nesnelerinden örtük dönüştürme kullanarak ve GrammarBuilderiki makePhrase nesnesi setPhrase başlatır.

Örnek son olarak bir Grammar nesneden nesneye Choices türeten bir GrammarBuilder nesne oluşturur.

private Grammar CreateColorGrammar()
{

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

  // Create grammar builders for the two versions of the phrase.
  GrammarBuilder makePhrase = new GrammarBuilder("Make background");
  makePhrase.Append(colorElement);
  GrammarBuilder setPhrase = new GrammarBuilder("Set background to");
  setPhrase.Append(colorElement);

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

Açıklamalar

Örtük dönüştürme yeni bir örneği GrammarBuilderoluşturur. Bu dönüştürme işleci, çağrılarak GrammarBuilder aynı phrasedeğerin belirtilmesine eşdeğerdir.

Bu işlecin eşdeğer yöntemi şudur: GrammarBuilder.GrammarBuilder(String)

Ayrıca bkz.

Şunlara uygulanır