0

好吧,伙计们,我现在正在制作一个用于语音识别的小 ap,但现在他只懂西班牙语,如果我用英语说话,他会在文本框列表中随机输入单词,你现在如何让他也能理解英语,怎么能我让他明白我一点点?

public partial class MainWindow : Window
{
    private SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine();
    public MainWindow()
    {
        InitializeComponent();
    }

    private void ButtonStart(object sender, RoutedEventArgs e)
    {
        recognizer.SetInputToDefaultAudioDevice();
        recognizer.LoadGrammar(new DictationGrammar());
        recognizer.SpeechRecognized += recognizer_SpeechRecognized;
        recognizer.RecognizeAsync(RecognizeMode.Multiple);

    }

    void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
    {
        foreach (RecognizedWordUnit word in e.Result.Words)
        {
            listBoxResult.Items.Add(word.Text);
        }
    }
}

}

4

1 回答 1

0

您可以重载SpeechRecognitionEngine(CultureInfo)实例。

例如 :

private SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine(new CultureInfo("en-EN"));
于 2013-04-27T20:24:26.097 回答