i've got a problem when i tried to use the sapi 5.4 sample code into a winform project

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<pre>using System;
using System.Speech.Recognition;

namespace SpeechRecognitionApp
{
class Program
{
static void Main(string[] args)
{

// Create an in-process speech recognizer for the en-US locale.
using (
SpeechRecognitionEngine recognizer =
new SpeechRecognitionEngine(
new System.Globalization.CultureInfo("en-US")))
{

// Create and load a dictation grammar.
recognizer.LoadGrammar(new DictationGrammar());

// Add a handler for the speech recognized event.
recognizer.SpeechRecognized +=
new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized);

// Configure input to the speech recognizer.
recognizer.SetInputToDefaultAudioDevice();

// Start asynchronous, continuous speech recognition.
recognizer.RecognizeAsync(RecognizeMode.Multiple);

// Keep the console window open.
while (true)
{
Console.ReadLine();
}
}
}

// Handle the SpeechRecognized event.
static void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
Console.WriteLine("Recognized text: " + e.Result.Text);
}
}
}
[/code]
<br/>
http://msdn.microsoft.com/en-us/library/system.speech.recognition.speechrecognitionengine.aspx http://msdn.microsoft.com/en-us/library/system.speech.recognition.speechrecognitionengine.aspx
the sample on MSDN
when i tried to create a winform project with the code.it seems had a problem.it didnt work!
can anybody give a sample of a winform project with sapi 5.4.

View the full article
 
Back
Top