void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { if (data.scores[0].label < 0) { form.PrintConsole(data.scores[0].sentence); if (data.scores[0].tags.Length > 0) { form.PrintConsole(data.scores[0].tags); } } else { form.ClearScores(); for (int i = 0; i < PXCMSpeechRecognition.NBEST_SIZE; i++) { int label = data.scores[i].label; int confidence = data.scores[i].confidence; if (label < 0 || confidence == 0) { continue; } form.SetScore(label, confidence); } if (data.scores[0].tags.Length > 0) { form.PrintConsole(data.scores[0].tags); } } }
private void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { if (data == null || data.scores == null || data.scores.Length == 0) { return; } FOutRecognitionData.SliceCount = 1; FOutRecognitionData[0] = data.scores[0].sentence; }
// 音声認識した語の通知ハンドラ // voice_recognition.cs サンプルより void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { // UIスレッドに同期的に処理を戻す context.Post(state => { ListRecognition.Items.Add("Dictation"); // ディクテーションモードの時はラベルがマイナスの値になる if (data.scores[0].label < 0) { ListRecognition.Items.Add(data.scores[0].sentence); } }, null); }
/// <summary> /// On word recognized /// </summary> private void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { if (data.scores[0].label < 0) { //sentencesRecognized.Add(data.scores[0].sentence); //if (data.scores[0].tags.Length > 0) //{ //tagsRecognized.Add(data.scores[0].tags); //} } else { for (int i = 0; i < PXCMSpeechRecognition.NBEST_SIZE; i++) { int label = data.scores[i].label; int confidence = data.scores[i].confidence; if (label < 0 || confidence == 0) { continue; } if (Commands.GetLength(0) < label) { Debug.Log("VoiceThreadError - UnrecognizedLabel"); SetError(SpeechManagerErrorType.VoiceThreadError_UnrecognizedLabel); continue; } if (commanndsRecognized.ContainsKey(Commands[label])) { commanndsRecognized.Remove(Commands[label]); } commanndsRecognized.Add(Commands[label], confidence); } //if (data.scores[0].tags.Length > 0) //{ //tagsRecognized.Add(data.scores[0].tags); //} } }
// 音声認識した語の通知ハンドラ void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { // UIスレッドに同期的に処理を戻す context.Post(state => { ListRecognition.Items.Add("Command"); // コマンドモードの時はラベルに登録したコマンドのインデックスが設定される for (int i = 0; i < PXCMSpeechRecognition.NBEST_SIZE; i++) { if (data.scores[i].label < 0 || data.scores[i].confidence == 0) { continue; } // 認識した語が信頼性の高い順に設定される ListRecognition.Items.Add(string.Format("{0}, {1}, {2}", data.scores[i].label, data.scores[i].confidence, data.scores[i].sentence)); } }, null); }
static void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { UnityEngine.Debug.Log("RECOGNIZED sentence : " + data.scores[0].sentence); UnityEngine.Debug.Log("RECOGNIZED tags : " + data.scores[0].tags); if (data.scores[0].sentence == "Create") { UnityEngine.Debug.Log("Call Create Function"); } if (data.scores[0].sentence == "Save") { UnityEngine.Debug.Log("Call Save Function"); } if (data.scores[0].sentence == "Load") { UnityEngine.Debug.Log("Call Load Function"); } if (data.scores[0].sentence == "Run") { UnityEngine.Debug.Log("Call Run Function"); } }
public static void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { UnityEngine.Debug.Log("RECOGNIZED sentence : " + data.scores[0].sentence); UnityEngine.Debug.Log("RECOGNIZED tags : " + data.scores[0].tags); if (data.scores[0].sentence == "Initialize") { UnityEngine.Debug.Log("Initialize Link Start Function"); isReadyToLoadLevel = true; } if (data.scores[0].sentence == "Restart") { UnityEngine.Debug.Log("Restart Function"); isReadyToRestartLevel = true; } //if (data.scores[0].sentence == "Load") //{ // UnityEngine.Debug.Log("Call Load Function"); //} //if (data.scores[0].sentence == "Run") //{ // UnityEngine.Debug.Log("Call Run Function"); //} }
public void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { if (data.scores[0].label < 0) { if (data.scores[0].confidence > 40) { //MessageBox.Show(data.scores[0].sentence); if (((data.scores[0].sentence == "search") || (data.scores[0].sentence == "find") || (data.scores[0].sentence == "show")) && FirstWindow) { SecondWindow = true; _disp.BeginInvoke((Action)(() => { ShowProducts(); })); } if ((data.scores[0].sentence == "next") && SecondWindow) { FirstWindow = false; _disp.BeginInvoke((Action)(() => { window2.GoNext(); })); } if ((data.scores[0].sentence == "back") && SecondWindow) { FirstWindow = false; _disp.BeginInvoke((Action)(() => { window2.GoBack(); })); } if ((data.scores[0].sentence == "buy") && SecondWindow) { FirstWindow = false; _disp.BeginInvoke((Action)(() => { window2.Buy(); })); } if (((data.scores[0].sentence == "logout") || (data.scores[0].sentence == "close")) && SecondWindow) { FirstWindow = true; _disp.BeginInvoke((Action)(() => { window2.LogOut(); })); } //// Search for a match in the numbers array //for (ctr = 0; ctr < SetSize; ctr++) //{ // if (numbers[ctr] == data.scores[0].sentence) // { // userAnswer = ctr; // break; // } //} //// Determine if user's verbal answer is correct or wrong //answerState = (ctr == product) ? AnswerState.Correct : AnswerState.Wrong; //// Update the UI and load another problem //UpdateUI(); //Thread.Sleep(PlayPause); //LoadNextProblem(); } } }
static void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { Console.WriteLine("RECOGNIZED sentence : " + data.scores[0].sentence); Console.WriteLine("RECOGNIZED tags : " + data.scores[0].tags); }
private void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { FireSpeechRecognized(data.scores[0].sentence); }
static void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { /* * Console.WriteLine("grammar :" + data.grammar); * foreach (var item in data.scores) * { * Console.WriteLine(string.Format("sentence : {0}, label : {1}, tags: {2}, confidence : {3} ", item.sentence, item.label, item.tags, item.confidence)); * }*/ // Process Recognition Data if (isRecognizing) { return; } const int ConfidenceFactor = 45; if (data.scores.Length <= 0) { return; } try { var selVoice = data.scores[0]; if (selVoice.confidence < ConfidenceFactor) { return; } isRecognizing = true; if (Perintah.ContainsKey(selVoice.sentence)) { string Result = string.Empty; bool GagalSuruh = false; Module selItem = Perintah[selVoice.sentence]; if (selItem.SpecialParam == "ACTIVATION") { isActive = true; } else if (selItem.SpecialParam == "DEACTIVATION") { isActive = false; } else if (selItem.isAction.HasValue && selItem.isAction.Value) { if (isActive) { if (!string.IsNullOrEmpty(selItem.CommandUrl)) { DoItNow(selItem.CommandUrl); } } else { GagalSuruh = true; } } if (selItem.isSpeak.HasValue && selItem.isSpeak.Value && !GagalSuruh) { VoiceSynthesis.Speak(selItem.MachineAnswer, 100, 0, 0); } else if (GagalSuruh) { VoiceSynthesis.Speak("Please say the keyword", 100, 0, 0); } if (!string.IsNullOrEmpty(Result)) { VoiceSynthesis.Speak(Result, 100, 0, 0); } } } catch { } finally { isRecognizing = false; } }