Esempio n. 1
0
        public string Think(string text)
        {
            ChatterBotThought t = new ChatterBotThought();

            t.Text = text;
            return(Think(t).Text);
        }
Esempio n. 2
0
		public ChatterBotThought Think(ChatterBotThought thought) {
			vars["input"] = thought.Text;
			
			string response = Utils.Post("http://www.pandorabots.com/pandora/talk-xml", vars);
			
			ChatterBotThought responseThought = new ChatterBotThought();
			responseThought.Text = Utils.XPathSearch(response, "//result/that/text()");
			
			return responseThought;
		}
Esempio n. 3
0
        public ChatterBotThought Think(ChatterBotThought thought)
        {
            vars["input"] = thought.Text;

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

            var responseThought = new ChatterBotThought();

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

            return(responseThought);
        }
Esempio n. 4
0
        public async Task <ChatterBotThought> Think(ChatterBotThought thought)
        {
            if (cookies == null)
            {
                cookies = await Utils.GetCookies(baseUrl);
            }

            vars["stimulus"] = thought.Text;

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

            vars["icognocheck"] = formDataDigest;

            string response = await Utils.Post(url, vars, cookies);

            string[] 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);

            ChatterBotThought responseThought = new ChatterBotThought();

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

            return(responseThought);
        }
Esempio n. 5
0
        public 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 cookies = Utils.GetCookies(baseUrl);

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

            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, 16);

            return responseThought;
        }
Esempio n. 6
0
 public ChatterBotThought Think(ChatterBotThought thought)
 {
     ChatterBotThought r = new ChatterBotThought();
     r.Text = Think(thought.Text);
     return r;
 }