Grammar.Name Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the name of a Grammar object.
public:
property System::String ^ Name { System::String ^ get(); void set(System::String ^ value); };
public string Name { get; set; }
member this.Name : string with get, set
Public Property Name As String
Property Value
The Name
property returns the name of the Grammar object. The default is null
.
Examples
The following example creates two Grammar objects, one for digits and one for fractions. The Grammar objects are assigned names and relative weights and priorities, and loaded by an in-process speech recognizer. The CreateDigitsGrammar
, CreateFractionsGrammar
, and recognizer_SpeechRecognized
methods are not shown here.
// Create a Grammar for recognizing numeric digits.
Grammar digitsGrammar = CreateDigitsGrammar();
digitsGrammar.Name = "Digits Grammar";
digitsGrammar.Priority = 2;
digitsGrammar.Weight = 0.6f;
// Create a Grammar for recognizing fractions.
Grammar fractionsGrammar = CreateFractionsGrammar();
fractionsGrammar.Name = "Fractions Grammar";
fractionsGrammar.Priority = 1;
fractionsGrammar.Weight = 1f;
// Create an in-process speech recognizer.
SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine();
recognizer.SpeechRecognized +=
new EventHandler<SpeechRecognizedEventArgs>(
recognizer_SpeechRecognized);
// Load the digits and fractions Grammar objects.
recognizer.LoadGrammar(digitsGrammar);
recognizer.LoadGrammar(fractionsGrammar);
// Start recognition.
recognizer.SetInputToDefaultAudioDevice();
recognizer.RecognizeAsync(RecognizeMode.Multiple);
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기