private void OnIntentHandler(object sender, SpeechIntentEventArgs e) { string intentionsLUIS = e.Payload; textIntentionGlobal += intentionsLUIS; JObject json = JObject.Parse(intentionsLUIS); }
private void OnIntentHandler(object sender, SpeechIntentEventArgs e) { string xxxxx = e.Payload; JObject json = JObject.Parse(xxxxx); //this.WriteLine("--- Intent received by OnIntentHandler() ---"); //this.WriteLine("{0}", e.Payload); //this.WriteLine(); }
private void OnIntentHandler(object sender, SpeechIntentEventArgs e) { if (OnIntentReceivedHandler != null) { IntentEvent evt = new IntentEvent() { Result = e.Payload }; OnIntentReceivedHandler(evt); } _speechClient.EndMicAndRecognition(); }
/// <summary> /// Called when a final response is received and its intent is parsed /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="SpeechIntentEventArgs"/> instance containing the event data.</param> private void OnIntentHandler(object sender, SpeechIntentEventArgs e) { this.WriteLine("--- Intent received by OnIntentHandler() ---"); if (!string.IsNullOrEmpty(e.Payload)) { this.WriteLine("{0}", e.Payload); using (var stream = new MemoryStream(Encoding.Default.GetBytes(e.Payload))) { DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(JsonSchemas.LUISJson.LUISJsonObject)); LUISJsonObject luisJson = (LUISJsonObject)ser.ReadObject(stream); identifyIntentAndPerformAction(luisJson); Trace.WriteLine(luisJson.Intents[0].IntentValue); } } else { setSystemWarningMessagesToSpeechLabel(SystemMessages.NOINTENT_MESSAGE); } }
// ---------------------------------------------------------------------------------------------------------------------------------------- void OnIntentHandler(object sender, SpeechIntentEventArgs e) { Console.WriteLine("--- Intent received by OnIntentHandler() ---"); Console.WriteLine("{0}", e.Payload); LuisAPIAnswer answer = new JavaScriptSerializer().Deserialize <LuisAPIAnswer>(e.Payload); if (!answer.topScoringIntent.Equals("None")) { MainFrame.CleanPath(); switch (answer.topScoringIntent.intent) { case "Movement": MovementEntityHandler(answer.entities); break; case "ChangeObjectPosition": ChangeObjectPositionHandler(answer.entities); break; case "Questions": QuestionsHandler(answer.entities); break; case "InputParameters": InputParametersHandler(answer.entities); break; case "None": TextToSpeech("No entiendo lo que quieres decir. Intenta de nuevo."); break; } } else { TextToSpeech("Esa acción no la conozco. ¡Intenta de nuevo!"); } }
/// <summary> /// Called when a final response is received and its intent is parsed /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="SpeechIntentEventArgs"/> instance containing the event data.</param> private void OnIntentHandler(object sender, SpeechIntentEventArgs e) { //this.WriteLine("--- Intent received by OnIntentHandler() ---"); //this.WriteLine("{0}", e.Payload); var _Data = JsonConvert.DeserializeObject <LUISResponse>(e.Payload); HandleIntent(_Data); //var employeeName = json["entities"].Count() != 0 ? (string)json["entities"][0].First.First : ""; //var MeetingType = json["entities"].Count() != 0 ? (string)json["entities"][1].First.First : ""; //var entityFound = _Data.entities.Count()>0 ? _Data.entities[0].entity : ""; // var topIntent = _Data.intents.Count()>0 ? _Data.intents[0].intent : ""; /* if (entityFound != "" && topIntent!="") * { * TextToSpeechNow("right , so do you have "+ topIntent + " with " + entityFound); * } * else * { * TextToSpeechNow("sorry i dont understand you. Who do you need to see here?"); * }*/ this.WriteLine(); }
/// <summary> /// Called when a final response is received and its intent is parsed /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="SpeechIntentEventArgs"/> instance containing the event data.</param> private void OnIntentHandler(object sender, SpeechIntentEventArgs e) { this.micClient.EndMicAndRecognition(); intenttype = IntentProcessor.ProcessIntent(e.Payload, WriteUserMessage, WriteSystemMessage, WriteIntent); this.Dispatcher.Invoke(() => { if (intenttype == 1) { active = true; imageAnimationController?.Play(); } if (intenttype == 2) { active = false; imageAnimationController?.Pause(); this.micClient.EndMicAndRecognition(); return; } this.micClient.EndMicAndRecognition(); // this.micClient.StartMicAndRecognition(); }); }
/// <summary> /// Called when a final response is received and its intent is parsed /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="SpeechIntentEventArgs"/> instance containing the event data.</param> private void OnIntentHandler(object sender, SpeechIntentEventArgs e) { Console.WriteLine("in intent handler"); this.WriteLine("--- Intent received by OnIntentHandler() ---"); //this.WriteLine("{0}", e.Payload); //this.WriteLine(); //TODO call output dialog /* * JavaScriptSerializer json_serializer = new JavaScriptSerializer(); * LUISResponse luisResponse = * (LUISResponse)json_serializer.DeserializeObject(e.Payload); */ Console.WriteLine("before deserialize"); LUISRootObject result = JsonConvert.DeserializeObject <LUISRootObject>(e.Payload); Console.WriteLine("after deserialize"); if (result != null && result.intents != null && result.intents.Count > 0) { Intent firstIntent = result.intents[0]; this.WriteLine("First intent detected:" + firstIntent.intent); Console.WriteLine("after first intent"); if (firstIntent.intent.Equals("Get.LoanEligibility") && firstIntent.score > 0.6) { Console.WriteLine("in loan eligibility"); this.WriteLine("Loan eligibility intent"); this.WriteKnowledgeBaseLine("Loan eligibility for this customer is $ 300,000"); this.WriteKnowledgeBaseLine("\n"); this.WriteProductRecommendationLine("This customer is eligible for premium loan product."); this.WriteProductRecommendationLine("\n"); } else if (firstIntent.intent.Equals("TransactionCharge") && firstIntent.score > 0.6) { Console.WriteLine("in transaction charge"); this.WriteKnowledgeBaseLine("This customer regularly transfers forex."); this.WriteKnowledgeBaseLine("This customer had raised a case about high transaction charges 1 month back."); this.WriteKnowledgeBaseLine("Ask about the transaction amount and charge is as below"); this.WriteKnowledgeBaseLine("3.5% for $100000 to $20000"); this.WriteKnowledgeBaseLine("2.5% for $200001 to $50000"); this.WriteKnowledgeBaseLine("2% for $500001 to $80000"); this.WriteKnowledgeBaseLine("\n"); this.WriteProductRecommendationLine("This customer is eligible for Gold Forex card."); this.WriteProductRecommendationLine("\n"); } else if (firstIntent.intent.Equals("NewCreditCard") && firstIntent.score > 0.6) { this.WriteKnowledgeBaseLine("You can ask customer to apply through Citi bank online site or through Citi bank branch."); this.WriteKnowledgeBaseLine("\n"); this.WriteProductRecommendationLine("This customer is eligible for Citigold card."); this.WriteProductRecommendationLine("You can offer document pickup to this customer."); this.WriteProductRecommendationLine("\n"); } else if (firstIntent.intent.Equals("AccountBalance") && firstIntent.score > 0.6) { this.WriteKnowledgeBaseLine("Your account balance is $200,000"); this.WriteKnowledgeBaseLine("\n"); this.WriteProductRecommendationLine("You can offer customer to invest in Fixed deposits or Liquid funds."); this.WriteProductRecommendationLine("\n"); } } }
/// <summary> /// Event handler function for intents. Raises a status event with the received intent /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnIntentReceived(object sender, SpeechIntentEventArgs e) { SpeechToTextEventArgs args = new SpeechToTextEventArgs(SttStatus.Success, $"Intent received: {e.Intent.ToString()}.\nPayload: {e.Payload}"); RaiseSttStatusUpdated(args); }
/// <summary> /// Called when a final response is received and its intent is parsed /// </summary> void OnIntentHandler(object sender, SpeechIntentEventArgs e) { Console.WriteLine("********* Final Intent *********"); Console.WriteLine("{0}", e.Payload); Console.WriteLine(); }
private void OnIntent(object sender, SpeechIntentEventArgs e) { WriteToLog(e.Payload, false); _queueClient.Send(new BrokeredMessage(new MemoryStream(Encoding.UTF8.GetBytes(e.Payload)))); }
private void Client_OnIntent(object sender, SpeechIntentEventArgs e) { systemLog.Debug($"{ prefix } Intent ..."); }
private void onIntentHandler(object sender, SpeechIntentEventArgs e) { RecognizeText.Add(e.Payload); MicClient.EndMicAndRecognition(); }
/// <summary> /// Called when a final response is received and its intent is parsed /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="SpeechIntentEventArgs"/> instance containing the event data.</param> private void OnIntentHandler(object sender, SpeechIntentEventArgs e) { this.WriteLine("--- Intent received by OnIntentHandler() ---"); this.WriteLine("{0}", e.Payload); this.WriteLine(); }
private static void OnIntentHandler(object sender, SpeechIntentEventArgs e) { Console.WriteLine($"OnIntentHandler - Payload: {e.Payload}"); }