0

我正在使用 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;
            }
        }
    }
4

2 回答 2

1

如果您没有将任何语法加载到识别器中,您将获得预定义的短信听写语法。

  // Load the pre-defined dictation grammar by default
  // and start recognition.
  SpeechRecognitionUIResult recoResult = await recoWithUI.RecognizeWithUIAsync();

  // Do something with the recognition result
  MessageBox.Show(string.Format("You said {0}.", recoResult.RecognitionResult.Text));
于 2013-11-04T18:29:41.047 回答
0

好吧,我不知道你在搜索什么,但也许这对你有帮助:http ://msicc.cloudapp.net/?p=3787

于 2013-11-03T11:13:01.087 回答