Closed sudo-d4s3 closed 7 years ago
Did you mod the chatterbotapi.py file ?
Can you paste here whats in your chatterbotapi.py file, near the lines 73 and 144
thought.text = text return self.think_thought(thought).text
class ChatterBotThought:
pass
#################################################
#################################################
class _Cleverbot(ChatterBot):
def __init__(self, baseUrl, serviceUrl, endIndex):
self.baseUrl = baseUrl
self.serviceUrl = serviceUrl
self.endIndex = endIndex
def create_session(self):
return _CleverbotSession(self)
class _CleverbotSession(ChatterBotSession):
def __init__(self, bot):
self.bot = bot
self.vars = OrderedDict()
#self.vars['start'] = 'y'
self.vars['stimulus'] = ''
self.vars['islearning'] = '1'
self.vars['icognoid'] = 'wsf'
#self.vars['fno'] = '0'
#self.vars['sub'] = 'Say'
#self.vars['cleanslate'] = 'false'
self.cookieJar = cookielib.CookieJar()
self.opener = build_opener(HTTPCookieProcessor(self.cookieJar))
self.opener.open(self.bot.baseUrl)
def think_thought(self, thought):
self.vars['stimulus'] = thought.text
data = urlencode(self.vars)
data_to_digest = data[9:self.bot.endIndex]
data_digest =
hashlib.md5(data_to_digest.encode('utf-8')).hexdigest() data = data + '&icognocheck=' + data_digest url_response = self.opener.open(self.bot.serviceUrl, data.encode('utf-8')) response = str(url_response.read()) response_values = re.split(r'\r|\r', response)
self.vars['sessionid'] = _utils_string_at_index(response_values, 1)
self.vars['logurl'] = _utils_string_at_index(response_values, 2)
self.vars['vText8'] = _utils_string_at_index(response_values, 3)
self.vars['vText7'] = _utils_string_at_index(response_values, 4)
self.vars['vText6'] = _utils_string_at_index(response_values, 5)
self.vars['vText5'] = _utils_string_at_index(response_values, 6)
self.vars['vText4'] = _utils_string_at_index(response_values, 7)
self.vars['vText3'] = _utils_string_at_index(response_values, 8)
self.vars['vText2'] = _utils_string_at_index(response_values, 9)
self.vars['prevref'] = _utils_string_at_index(response_values, 10)
#self.vars['??'] = _utils_string_at_index(response_values, 11)
_utils_string_at_index(response_values, 12)
13)
14)
15)
20)
_utils_string_at_index(response_values, 21)
22)
response_thought = ChatterBotThought()
response_thought.text = _utils_string_at_index(response_values, 0)
On Tue, May 10, 2016 at 3:03 PM, Pierre-David Bélanger < notifications@github.com> wrote:
Did you mod the chatterbotapi.py https://github.com/pierredavidbelanger/chatter-bot-api/blob/master/python/chatterbotapi.py file ?
Can you paste here whats in your chatterbotapi.py https://github.com/pierredavidbelanger/chatter-bot-api/blob/master/python/chatterbotapi.py file, near the lines 73 https://github.com/pierredavidbelanger/chatter-bot-api/blob/master/python/chatterbotapi.py#L73 and 144 https://github.com/pierredavidbelanger/chatter-bot-api/blob/master/python/chatterbotapi.py#L144
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/pierredavidbelanger/chatter-bot-api/issues/27#issuecomment-218274146
This is strange.
I do not know your OS, or even if you are executing this is an terminal.
But, if you happen to use a unix like OS (linux or osx), execute the locale
command in a terminal and paste the output here.
It should give you something like this:
$ locale
LANG="fr_CA.UTF-8"
LC_COLLATE="fr_CA.UTF-8"
LC_CTYPE="fr_CA.UTF-8"
LC_MESSAGES="fr_CA.UTF-8"
LC_MONETARY="fr_CA.UTF-8"
LC_NUMERIC="fr_CA.UTF-8"
LC_TIME="fr_CA.UTF-8"
LC_ALL=
I am running this on windows, with python idle but on another pc and it doesn't do this On May 11, 2016 3:01 PM, "Pierre-David Bélanger" notifications@github.com wrote:
This is strange. I do not know your OS, or even if you are executing this is an terminal. But, if you happen to use a unix like OS (linux or osx), execute the locale command in a terminal and paste the output here. It should give you something like this:
$ locale LANG="fr_CA.UTF-8" LC_COLLATE="fr_CA.UTF-8" LC_CTYPE="fr_CA.UTF-8" LC_MESSAGES="fr_CA.UTF-8" LC_MONETARY="fr_CA.UTF-8" LC_NUMERIC="fr_CA.UTF-8" LC_TIME="fr_CA.UTF-8" LC_ALL=
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/pierredavidbelanger/chatter-bot-api/issues/27#issuecomment-218572902
I do not have access to Windows, so I can not reproduce this strange bug. Are you able to tel what is the difference between the two pc ? Maybe the Python version, the OS locale, the IDE ..
Also, before your program (after the from chatterbotapi import ChatterBotFactory, ChatterBotType
), try putting those lines:
import locale
locale.setlocale(locale.LC_ALL, '')
Anyways, I guess it has something to do with your OS regional or locale settings.
I don't know what I'm doing wrong this is my code
and here is the output
bot1> Hi bot2> b'Ja jestem ch\xc5\x82opakiem palancie. bot1> b"That's not english. bot2> b'Yash, it is. bot1> b"Your last message was, but not the one before. bot2> b'What are you doing? bot1> b"Talking to you. What are you doing? bot2> b'Talking with you. I think. bot1> b"Ohhh, that was suprising.