public string makeSentence(Objects.O_NLP.RootObject _o_NLP) { try { // Bind to the wit.ai NLP response class o_NLP = _o_NLP; conf = (o_NLP.outcome.confidence * 100); string sentence = ""; sentence += "I'm " + conf.ToString() + "% sure you want me to do something."; // Try {} catch {} are quick fixes to exceptions, code should be made more robust to handle // the various types // This is also the place to add your custom code to the intent, ie. add the appointment or process the action try { string obj = o_NLP.outcome.entities._object[0].value; sentence += Environment.NewLine + "You want to interact with: " + obj; try { string action = o_NLP.outcome.entities.on_off[0].value; sentence += Environment.NewLine + "You want it: " + action; } catch { } } catch { } try { try { string obj2 = o_NLP.outcome.entities.contact[0].value; sentence += Environment.NewLine + "You want to send a message to: " + obj2; } catch { } string obj = o_NLP.outcome.entities.message_body[0].value; sentence += Environment.NewLine + "You want to send this message: " + obj; } catch { } return(sentence); } catch (Exception ex) { return("Uh oh, something went wrong: " + ex.Message); } }
public string makeSentence(Objects.O_NLP.RootObject _o_NLP) { try { // Bind to the wit.ai NLP response class o_NLP = _o_NLP; conf = (o_NLP.outcome.confidence * 100); string sentence = ""; sentence += "I'm " + conf.ToString() + "% sure you posed a question."; // Try {} catch {} are quick fixes to exceptions, code should be made more robust to handle // the various types // This is also the place to add your custom code to the intent, ie. add the appointment or process the action try { string math = o_NLP.outcome.entities.math_expression[0].value; sentence += Environment.NewLine + "You want to know the outcome of " + math + "."; } catch { try { foreach (Objects.O_NLP._Question q in o_NLP.outcome.entities.question) { sentence += Environment.NewLine + "You want to know about: " + q.value + "."; } } catch { sentence += Environment.NewLine + "Not sure how to answer it, though."; } } return(sentence); } catch (Exception ex) { return("Uh oh, something went wrong: " + ex.Message); } }
public string makeSentence(Objects.O_NLP.RootObject _o_NLP) { try { // Bind to the wit.ai NLP response class o_NLP = _o_NLP; conf = (o_NLP.outcome.confidence * 100); string sentence = ""; sentence += "I'm " + conf.ToString() + "% sure you are talking about appointments."; // Try {} catch {} are quick fixes to exceptions, code should be made more robust to handle // the various types // This is also the place to add your custom code to the intent, ie. add the appointment or process the action try { string appointment = o_NLP.outcome.entities.agenda_entry[0].value; sentence += Environment.NewLine + "You want to make this appointment: " + appointment; try { string startdate = o_NLP.outcome.entities.datetime[0].value.from.ToString(); sentence += Environment.NewLine + "You want it: " + startdate; try { string enddate = o_NLP.outcome.entities.datetime[0].value.to.ToString(); sentence += Environment.NewLine + "You want it 'till: " + enddate; } catch { } } catch { } } catch { } return(sentence); } catch (Exception ex) { return("Uh oh, something went wrong: " + ex.Message); } }
public string makeSentence(Objects.O_NLP.RootObject _o_NLP) { try { // Bind to the wit.ai NLP response class o_NLP = _o_NLP; conf = (o_NLP.outcomes.confidence * 100); string sentence = ""; string Day = o_NLP.outcomes.entities.day[0].value; string Country = o_NLP.outcomes.entities.location[0].value; sentence += "How is the weather in " + Country + " for " + Day; return(sentence); } catch (Exception ex) { return("Uh oh, something went wrong: " + ex.Message); } }
public string makeSentence(Objects.O_NLP.RootObject _o_NLP) { try { // Bind to the wit.ai NLP response class o_NLP = _o_NLP; conf = (o_NLP.outcome.confidence * 100); string sentence = ""; sentence += "Bye! I'm " + conf.ToString() + "% sure you're saying goodbye."; return(sentence); } catch (Exception ex) { return("Uh oh, something went wrong: " + ex.Message); } }
public string makeSentence(Objects.O_NLP.RootObject _o_NLP) { try { // Bind to the wit.ai NLP response class o_NLP = _o_NLP; conf = (o_NLP.outcomes.confidence * 100); string sentence = ""; // string Day = o_NLP.outcomes.entities.day[0].value; // string Country = o_NLP.outcomes.entities.location[0].value; string normalized = o_NLP.outcomes.entities.duration[0].normalized[0].value; sentence += Environment.NewLine + "You want: " + normalized; return(sentence); } catch (Exception ex) { return("Uh oh, something went wrong: " + ex.Message); } }
public string makeSentence(Objects.O_NLP.RootObject _o_NLP) { try { // Bind to the wit.ai NLP response class o_NLP = _o_NLP; conf = (o_NLP.outcome.confidence * 100); string sentence = ""; sentence += "I think you want something from me."; // Try {} catch {} are quick fixes to exceptions, code should be made more robust to handle // the various types // This is also the place to add your custom code to the intent, ie. add the appointment or process the action try { sentence += Environment.NewLine + "You want a " + o_NLP.outcome.entities._object[0].value + "."; } catch { } try { sentence += " You want it on " + o_NLP.outcome.entities.datetime[0].value.from.DayOfWeek + "."; } catch { } sentence += " I'm " + conf.ToString() + "% sure of this."; return(sentence); } catch (Exception ex) { return("Uh oh, something went wrong: " + ex.Message); } }
public string makeSentence(Objects.O_NLP.RootObject _o_NLP, int type) { string remind = ""; string obj = ""; string day = ""; string timehour = ""; string timeminute = ""; string reminder_task = ""; try { // Bind to the wit.ai NLP response class o_NLP = _o_NLP; conf = (o_NLP.outcomes.confidence * 100); string sentence = ""; ////////////// string result = ""; string subresult = ""; string subday = ""; string subhour = ""; string subminute = ""; ///////////// sentence += "I'm " + conf.ToString() + "% sure you are setting reminder."; // Try {} catch {} are quick fixes to exceptions, code should be made more robust to handle // the various types // This is also the place to add your custom code to the intent, ie. add the appointment or process the action try { obj = o_NLP.outcomes.entities.com_obj[0].value; remind = o_NLP.outcomes.entities.com_remind[0].value; // timehour = o_NLP.outcomes.entities.datetime[0].value.Hour.ToString(); // timeminute = o_NLP.outcomes.entities.datetime[0].value.Minute.ToString(); reminder_task = o_NLP.outcomes.entities.reminder[0].value.ToString(); try { day = o_NLP.outcomes.entities.day[0].value; } catch { day = "today"; } try { result = "SGM_FUNC_COMPLEX_SetReminderSuccess"; subresult = obj; subday = day; subhour = timehour; subminute = timeminute; } catch { result = "SGM_FUNC_COMPLEX_SetReminderNotEnoughInfo"; } // else // { // sentence += Environment.NewLine + "The obj doesn't matched any conditions: " + remind; //result += "Sorry, i don't quite understand this"; //unknown obj // } } catch { result = "SGM_FUNC_COMPLEX_SetReminderNotEnoughInfo"; } if (type == 1) { return(result); } else if (type == 2) { return(subresult); } else if (type == 3) { return(subday); } else if (type == 4) { return(subhour.ToString()); } else if (type == 5) { return(subminute.ToString()); } else { return(sentence); } } catch (Exception ex) { if (type == 1) { return("Uh oh, something went wrong."); } else { return("Uh oh, something went wrong: " + ex.Message); } } }
public string makeSentence(Objects.O_NLP.RootObject _o_NLP) { string obj = "Unassigned"; try { // Bind to the wit.ai NLP response class o_NLP = _o_NLP; //conf = (o_NLP.outcomes.confidence * 100); string sentence = ""; string result = ""; string subresult = ""; sentence += "I'm " + conf.ToString() + "% sure you are asking for President or Prime Minister."; // Try {} catch {} are quick fixes to exceptions, code should be made more robust to handle // the various types // This is also the place to add your custom code to the intent, ie. add the appointment or process the action try { obj = o_NLP.entities.role[0].value; sentence += Environment.NewLine + "You want: " + obj; result = "Do you mean" + obj + "?"; //unknown obj } catch { } string country = ""; if (obj == "president") { try { country = o_NLP.entities.location[0].value; subresult = "Who is the president of " + country; } catch { } } else if (obj == "prime minister") { try { country = o_NLP.entities.location[0].value; subresult = "Who is the prime minister of " + country; } catch { } } else { sentence += Environment.NewLine + "The obj doesn't matched any conditions: " + obj; } // if (type == 1) // { // return result; // } // else if (type == 2) // { // return subresult; // } // else return(sentence); } catch (Exception ex) { // if (type == 1) // { return("Uh oh, something went wrong."); // } // else // return "Uh oh, something went wrong: " + ex.Message; } }