public String Cognize(string query) { Utterance utterance = new Utterance(); utterance.Query = query; for (int i = 0; i < _intentList.Count; i++) utterance.Intents.Add(_binaryClassificators[i].Classify(query)); return getJSON(utterance); }
String getJSON(Utterance utterance) { JObject json = new JObject( new JProperty("query", utterance.Query), new JProperty("intents", new JArray( from intent in utterance.Intents orderby intent.Score descending select new JObject( new JProperty("intent", intent.Name), new JProperty("score", intent.Score) ) ) ) ); return json.ToString(); }
public JObject Cognize(string query, bool debug = false) { Utterance utterance = new Utterance(); utterance.Query = query; for (int i = 0; i < _intentList.Count; i++) { utterance.Intents.Add(_binaryClassificators[i].Classify(query, debug)); } if (utterance.TopScoringIntent.Score < 0.8) { utterance.Intents.Add(new Intent("none", (float)0.8)); } EntityExtractors.EntityExtractorController.Fetch(utterance); return(utterance.GetResponse()); }