예제 #1
0
 //TODO: Abstract out Audio as well
 public RecognitionSuccess()
 {
     Semantics = new Dictionary<string, string>();
     Confidence = 1.0F;
     WordConfidence = new Dictionary<int, Tuple<string, float>>();
     Text = "";
     Audio = null;
     GrammarName = "";
     EngineName = "";
     Engine = null;
 }
예제 #2
0
 public RecognitionSuccess(AudioRecog r, RecognitionResult rres)
 {
     EngineName = "SAPI";
     Engine = r;
     Semantics = new Dictionary<string, string>();
     if (rres.Semantics != null)
     {
         foreach (KeyValuePair<String, SemanticValue> s in rres.Semantics)
         {
             Semantics.Add(s.Key, s.Value.Value.ToString()); //need the ToString() as this may be an int etc
         }
     }
     Audio = rres.Audio;
     Text = rres.Text;
     GrammarName = rres.Grammar.Name;
     Confidence = rres.Confidence;
     WordConfidence = new Dictionary<int, Tuple<string, float>>();
     int i = 0;
     foreach (System.Speech.Recognition.RecognizedWordUnit wd in rres.Words)
     {
         WordConfidence.Add(i, new Tuple<string, float>(wd.Text, wd.Confidence));
         i++;
     }
 }
예제 #3
0
 public RecognitionAttempt_Engine(AudioRecog eng)
 {
     Engine = eng;
     isRunning = false;
     isComplete = false;
     Success = null;
 }
예제 #4
0
 public void Recognised(AudioRecog engine, RecognitionSuccess success)
 {
     if (!AttemptByEngine.ContainsKey(engine))
     {
         Form1.updateLog("ERR: Complete for unknown engine", ELogLevel.Error, ELogType.SpeechRecog);
         return;
     }
     AttemptByEngine[engine].TimeRecog = DateTime.Now;
     AttemptByEngine[engine].Success = success;
 }
예제 #5
0
 public void Completed(AudioRecog engine)
 {
     if (!AttemptByEngine.ContainsKey(engine))
     {
         Form1.updateLog("ERR: Complete for unknown engine", ELogLevel.Error, ELogType.SpeechRecog);
         return;
     }
     AttemptByEngine[engine].TimeComplete = DateTime.Now;
     AttemptByEngine[engine].isComplete = true;
     AttemptByEngine[engine].isRunning = false;
 }
예제 #6
0
 protected void OnRecognitionSuccessful(AudioRecog engine, string ID, RecognitionSuccess res)
 {
     if (RecognitionSuccessful != null)
     {
         RecognitionSuccessful(this, new RecognitionSuccessfulEventArgs(engine, ID, res));
     }
 }
예제 #7
0
 public bool RegisterRecogEngine(AudioRecog rec)
 {
     RecogEngines.Add(rec);
     rec.RecognitionSuccessful += new AudioRecog.RecognitionSuccessfulDelegate(rec_RecognitionSuccessful);
     rec.RecognitionComplete += new AudioRecog.RecognitionCompleteDelegate(rec_RecognitionComplete);
     return true;
 }