我正在使用 c#/xaml 开发 Windows Phone 8 应用程序。我基本上是在尝试将语音转换为文本并将其存储在文本框中。语音输入将是正常的英语。但为此,我想我需要创建整个语法文件。有什么现成的,或者我错过了什么。请帮忙
private async void record_Click(object sender, EventArgs e)
{
// Begin recognition using the default grammar and store the result.
SpeechRecognitionUIResult recoResult = await recoWithUI.RecognizeWithUIAsync();
recoWithUI.Recognizer.Grammars.AddGrammarFromPredefinedType("message", SpeechPredefinedGrammar.Dictation);
await this.recoWithUI.Recognizer.PreloadGrammarsAsync();
// Check that a result was obtained
if (recoResult.RecognitionResult != null)
{
// Determine if the user wants to save the note.
var result = MessageBox.Show(string.Format("Heard you say \"{0}\" Save?", recoResult.RecognitionResult.Text), "Confirmation", MessageBoxButton.OKCancel);
// Save the result to the Azure Mobile Service DB if the user is satisfied.
if (result == MessageBoxResult.OK)
{
voicetext.Text = recoResult.RecognitionResult.Text;
}
}
}