开发者

problem in recognition of numbers in system.speech?

speech and i added grmmar which only detects numbers like this

            SpeechRecognitionEngine RecognitionEngine = new SpeechRecognitionEngine(new CultureInfo("en-US", true));

            // Created Grammar For only Number开发者_如何学Cs 1 to 10
            var NumberChoice = new Choices();
            for (var i = 0; i <= 10; i++)
            {
                NumberChoice.Add(i.ToString());
            }
            var NumGrammarBuilder = new GrammarBuilder(NumberChoice);
            var NumGrammar = new Grammar(NumGrammarBuilder);
            RecognitionEngine.LoadGrammar(NumGrammar);

            RecognitionEngine.SetInputToDefaultAudioDevice();
            RecognitionResult Result = RecognitionEngine.Recognize();

            txt_vtc.Text = Result.Text;

But when i speak the outputs are getting different some times, when i say two it gets eight and the most worse thing is when i switch on my fan and speak , its not recognizing even for small sound. so is this is usefull for normal client? When the client says pin, it has to capture the pin code and save it in text file.. is this is usefull for me..

its more than enough if it recognizes from 1 to 10 correctly for me? Can anybody help me in this scenario. can i show progress bar or any meter when the user speaks? can i use ENglish - UK Culture to my speech recognition? Do we have any third party dlls for this?

Regards Bhuvan


you can try this code sample in order to overcome your problem

  SpeechRecognitionEngine rec = new SpeechRecognitionEngine();
  var c = new Choices();
  for (var i = 0; i <= 100; i++)
      c.Add(i.ToString());
  var gb = new GrammarBuilder(c);
  var g = new Grammar(gb);
  g.Priority = 127;
  rec.SetInputToDefaultAudioDevice();

  rec.LoadGrammar(g);
  rec.RecognizeAsync(RecognizeMode.Multiple);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜