Answer the question
In order to leave comments, you need to log in
Speech recognition in C#?
Created a simple WinForm program that recognizes speech using the Microsoft.Speech library. Everything works fine, but there is one drawback and this is the creation of grammar. That is, he understands only certain words. Tell me how to do without creating a grammar, or advise another offline speech recognizer without a grammar.
SpeechRecognitionEngine sre;
CultureInfo ci;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
ci = new CultureInfo("ru-RU");
sre = new SpeechRecognitionEngine(ci);
sre.SetInputToDefaultAudioDevice();
sre.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(Sre_SpeechRecognized);
Choices ch = new Choices();
ch.Add("Привет");
GrammarBuilder gb = new GrammarBuilder();
gb.Append(ch);
Grammar grammar = new Grammar(gb);
sre.LoadGrammar(grammar);
sre.RecognizeAsync(RecognizeMode.Multiple);
}
private void Sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
if (e.Result.Confidence > 0.12)
{
MessageBox.Show(e.Result.Text);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question