problem in recognition of numbers in system.speech?

老子叫甜甜 提交于 2019-12-13 15:43:13

问题


speech and i added grmmar which only detects numbers like this

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

            // Created Grammar For only Numbers 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


回答1:


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);


来源:https://stackoverflow.com/questions/6493143/problem-in-recognition-of-numbers-in-system-speech

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!