Aracılığıyla paylaş


GrammarBuilder.Implicit Operatör

Tanım

Başka bir türü öğesine dönüştürür GrammarBuilder .

Aşırı Yüklemeler

Implicit(Choices to GrammarBuilder)

Nesneyi Choices GrammarBuilder nesnesine dönüştürür.

Implicit(SemanticResultKey to GrammarBuilder)

Nesneyi SemanticResultKey GrammarBuilder nesnesine dönüştürür.

Implicit(SemanticResultValue to GrammarBuilder)

Nesneyi SemanticResultValue GrammarBuilder nesnesine dönüştürür.

Implicit(String to GrammarBuilder)

Bir dizeyi GrammarBuilder nesnesine dönüştürür.

Açıklamalar

Örtük dönüştürme yeni bir örneğini oluşturur GrammarBuilder . Aşağıdaki sınıfların her birini bir öğesine çevirebilirsiniz GrammarBuilder .

Örtük her bir değer, oluşturucuyu çağırmaya eşdeğerdir.

Implicit(Choices to GrammarBuilder)

Nesneyi Choices GrammarBuilder nesnesine 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

GrammarBuilder

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

Örnekler

Aşağıdaki örnek, "Evet" veya "Hayır" sorusu yanıtını tanıyabileceğiniz bir konuşma tanıma dilbilgisi oluşturur. Örtük dönüştürme işleci, bir nesnenin bir nesneden, iki nesneden bir nesnenin yapılanmasının ve bir nesneden bir nesnenin SemanticResultValue Choices Choices SemanticResultValue yapılanmasının üzerinde Grammar oluşturulması için kullanılır SemanticResultKey .

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ğini oluşturur GrammarBuilder . Bu dönüştürme işleci GrammarBuilder , için çağırarak ve belirtilerek eşdeğerdir choices alternateChoices .

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

Ayrıca bkz.

Şunlara uygulanır

Implicit(SemanticResultKey to GrammarBuilder)

Nesneyi SemanticResultKey GrammarBuilder nesnesine 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 anlamsal anahtar.

Döndürülenler

GrammarBuilder

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

Örnekler

Aşağıdaki örnek, "Evet" veya "Hayır" sorusu yanıtını tanıyabileceğiniz bir konuşma tanıma dilbilgisi oluşturur. Örtük dönüştürme işleci, bir nesnenin bir nesneden, iki nesneden bir nesnenin yapılanmasının ve bir nesneden bir nesnenin SemanticResultValue Choices Choices SemanticResultValue yapılanmasının üzerinde Grammar oluşturulması için kullanılır SemanticResultKey .

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ğini oluşturur GrammarBuilder . Bu dönüştürme işleci GrammarBuilder , için çağırarak ve belirtilerek eşdeğerdir semanticKey key .

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

Ayrıca bkz.

Şunlara uygulanır

Implicit(SemanticResultValue to GrammarBuilder)

Nesneyi SemanticResultValue GrammarBuilder nesnesine 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

SemanticResultValueDönüştürülecek nesne.

Döndürülenler

GrammarBuilder

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

Örnekler

Aşağıdaki örnek, "Evet" veya "Hayır" sorusu yanıtını tanıyabileceğiniz bir konuşma tanıma dilbilgisi oluşturur. Örtük dönüştürme işleci, bir nesnenin bir nesneden, iki nesneden bir nesnenin yapılanmasının ve bir nesneden bir nesnenin SemanticResultValue Choices Choices SemanticResultValue yapılanmasının üzerinde Grammar oluşturulması için kullanılır SemanticResultKey .

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ğini oluşturur GrammarBuilder . Bu dönüştürme işleci GrammarBuilder , için çağırarak ve belirtilerek eşdeğerdir semanticValue value .

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

Ayrıca bkz.

Şunlara uygulanır

Implicit(String to GrammarBuilder)

Bir dizeyi GrammarBuilder nesnesine 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

GrammarBuilder

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

Örnekler

Aşağıdaki örnek GrammarBuilder Choices , "arka plan renkseçimi yap" veya "arka planı colorChoice olarak ayarla" gibi iki tümcecikden birini tanıyabilecek bir dilbilgisi oluşturmak için ve nesnelerini kullanır.

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

Örnek olarak, nesneye bir nesne atama nesnesinden bir nesne oluşturur Grammar Choices GrammarBuilder .

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ğini oluşturur GrammarBuilder . Bu dönüştürme işleci GrammarBuilder , çağırarak ve belirtmeye eşdeğerdir phrase .

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

Ayrıca bkz.

Şunlara uygulanır