Ejemplo n.º 1
0
        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);

        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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());
        }