public function thinkThought($thought) { $this->vars['input'] = $thought->getText(); $response = _utils_post('http://www.pandorabots.com/pandora/talk-xml', $this->vars); $element = new SimpleXMLElement($response); $result = $element->xpath('//result/that/text()'); $responseThought = new ChatterBotThought(); $responseThought->setText(trim($result[0][0])); return $responseThought; }
/** * Return a new thought based on given string * @param string $text The text * * @return \ChatterBotApi\ChatterBotThought The new thought. */ public function think($text) { $thought = ChatterBotThought::make($text); return $this->thinkThought($thought); }