Esempio n. 1
0
 public static Tuple <float, string>[] Recognize(byte[] wav, string culture = "fr-FR")
 {
     using (var engine = new SpeechRecoSystem())
     {
         var results = new List <Tuple <float, string> >();
         var res     = engine.Feed(wav);
         if (res != null)
         {
             results.Add(new Tuple <float, string>(res.Confidence, res.Text));
         }
         return(results.ToArray());
     }
 }
Esempio n. 2
0
 public static IEnumerable <Tuple <float, string> > EnumerateRecognize(string culture = "fr-FR")
 {
     using (var engine = new SpeechRecoSystem())
     {
         engine.Feed();
         while (true)
         {
             var item = engine.WaitForText();
             if (item != null)
             {
                 yield return(new Tuple <float, string>(item.Confidence, item.Text));
             }
         }
     }
 }