Пример #1
0
        public async Task<ChatterBotThought> Think(ChatterBotThought thought)
        {
            vars["input"] = thought.Text;

            var response = await Utils.Post("http://www.pandorabots.com/pandora/talk-xml", vars, null).ConfigureAwait(false);

            var responseThought = new ChatterBotThought();
            responseThought.Text = Utils.XPathSearch(response, "//result/that/text()");

            return responseThought;
        }
Пример #2
0
        public async Task <ChatterBotThought> Think(ChatterBotThought thought)
        {
            vars["input"] = thought.Text;

            var response = await Utils.Post("http://www.pandorabots.com/pandora/talk-xml", vars, null).ConfigureAwait(false);

            var responseThought = new ChatterBotThought();

            responseThought.Text = Utils.XPathSearch(response, "//result/that/text()");

            return(responseThought);
        }
Пример #3
0
        public async Task <ChatterBotThought> Think(ChatterBotThought thought)
        {
            vars["stimulus"] = thought.Text;

            var formData         = Utils.ParametersToWWWFormURLEncoded(vars);
            var formDataToDigest = formData.Substring(9, endIndex);
            var formDataDigest   = Utils.MD5(formDataToDigest);

            vars["icognocheck"] = formDataDigest;

            var response = await Utils.Post(url, vars, cookies).ConfigureAwait(false);

            var responseValues = response.Split('\r');

            //vars[""] = Utils.StringAtIndex(responseValues, 0); ??
            vars["sessionid"] = Utils.StringAtIndex(responseValues, 1);
            vars["logurl"]    = Utils.StringAtIndex(responseValues, 2);
            vars["vText8"]    = Utils.StringAtIndex(responseValues, 3);
            vars["vText7"]    = Utils.StringAtIndex(responseValues, 4);
            vars["vText6"]    = Utils.StringAtIndex(responseValues, 5);
            vars["vText5"]    = Utils.StringAtIndex(responseValues, 6);
            vars["vText4"]    = Utils.StringAtIndex(responseValues, 7);
            vars["vText3"]    = Utils.StringAtIndex(responseValues, 8);
            vars["vText2"]    = Utils.StringAtIndex(responseValues, 9);
            vars["prevref"]   = Utils.StringAtIndex(responseValues, 10);
            //vars[""] = Utils.StringAtIndex(responseValues, 11); ??
//            vars["emotionalhistory"] = Utils.StringAtIndex(responseValues, 12);
//            vars["ttsLocMP3"] = Utils.StringAtIndex(responseValues, 13);
//            vars["ttsLocTXT"] = Utils.StringAtIndex(responseValues, 14);
//            vars["ttsLocTXT3"] = Utils.StringAtIndex(responseValues, 15);
//            vars["ttsText"] = Utils.StringAtIndex(responseValues, 16);
//            vars["lineRef"] = Utils.StringAtIndex(responseValues, 17);
//            vars["lineURL"] = Utils.StringAtIndex(responseValues, 18);
//            vars["linePOST"] = Utils.StringAtIndex(responseValues, 19);
//            vars["lineChoices"] = Utils.StringAtIndex(responseValues, 20);
//            vars["lineChoicesAbbrev"] = Utils.StringAtIndex(responseValues, 21);
//            vars["typingData"] = Utils.StringAtIndex(responseValues, 22);
//            vars["divert"] = Utils.StringAtIndex(responseValues, 23);

            var responseThought = new ChatterBotThought();

            responseThought.Text = Utils.StringAtIndex(responseValues, 0);

            return(responseThought);
        }
Пример #4
0
        public async Task<ChatterBotThought> Think(ChatterBotThought thought)
        {
            vars["stimulus"] = thought.Text;

            var formData = Utils.ParametersToWWWFormURLEncoded(vars);
            var formDataToDigest = formData.Substring(9, endIndex);
            var formDataDigest = Utils.MD5(formDataToDigest);
            vars["icognocheck"] = formDataDigest;

            var response = await Utils.Post(url, vars, cookies).ConfigureAwait(false);

            var responseValues = response.Split('\r');

            //vars[""] = Utils.StringAtIndex(responseValues, 0); ??
            vars["sessionid"] = Utils.StringAtIndex(responseValues, 1);
            vars["logurl"] = Utils.StringAtIndex(responseValues, 2);
            vars["vText8"] = Utils.StringAtIndex(responseValues, 3);
            vars["vText7"] = Utils.StringAtIndex(responseValues, 4);
            vars["vText6"] = Utils.StringAtIndex(responseValues, 5);
            vars["vText5"] = Utils.StringAtIndex(responseValues, 6);
            vars["vText4"] = Utils.StringAtIndex(responseValues, 7);
            vars["vText3"] = Utils.StringAtIndex(responseValues, 8);
            vars["vText2"] = Utils.StringAtIndex(responseValues, 9);
            vars["prevref"] = Utils.StringAtIndex(responseValues, 10);
            //vars[""] = Utils.StringAtIndex(responseValues, 11); ??
//            vars["emotionalhistory"] = Utils.StringAtIndex(responseValues, 12);
//            vars["ttsLocMP3"] = Utils.StringAtIndex(responseValues, 13);
//            vars["ttsLocTXT"] = Utils.StringAtIndex(responseValues, 14);
//            vars["ttsLocTXT3"] = Utils.StringAtIndex(responseValues, 15);
//            vars["ttsText"] = Utils.StringAtIndex(responseValues, 16);
//            vars["lineRef"] = Utils.StringAtIndex(responseValues, 17);
//            vars["lineURL"] = Utils.StringAtIndex(responseValues, 18);
//            vars["linePOST"] = Utils.StringAtIndex(responseValues, 19);
//            vars["lineChoices"] = Utils.StringAtIndex(responseValues, 20);
//            vars["lineChoicesAbbrev"] = Utils.StringAtIndex(responseValues, 21);
//            vars["typingData"] = Utils.StringAtIndex(responseValues, 22);
//            vars["divert"] = Utils.StringAtIndex(responseValues, 23);

            var responseThought = new ChatterBotThought();

            responseThought.Text = Utils.StringAtIndex(responseValues, 0);

            return responseThought;
        }