2017-06-22 4 views
1

Je suis en train de courir TwitterTrainer du conversationnel sur un programme distinct comme ceci:conversationnel erreur de codage ASCII twitter_trainer

from chatterbot import ChatBot 
from chatterbot.trainers import TwitterTrainer 
from settings import TWITTER 
import logging 

# Comment out the following line to disable verbose logging 
logging.basicConfig(level=logging.INFO) 

chatbot = ChatBot("TwitterBot", 
    logic_adapters=[ 
     "chatterbot.logic.BestMatch" 
    ], 
    input_adapter="chatterbot.input.TerminalAdapter", 
    output_adapter="chatterbot.output.TerminalAdapter", 
    database="./twitter-database.db", 
    twitter_consumer_key=TWITTER["CONSUMER_KEY"], 
    twitter_consumer_secret=TWITTER["CONSUMER_SECRET"], 
    twitter_access_token_key=TWITTER["ACCESS_TOKEN"], 
    twitter_access_token_secret=TWITTER["ACCESS_TOKEN_SECRET"], 
    trainer="chatterbot.trainers.TwitterTrainer", 
    random_seed_word="random" 
) 

chatbot.train() 

chatbot.logger.info('Trained database generated successfully!') 

Et je reçois des erreurs qui ont l'air comme ça:

File "C:\Python27\lib\json\decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Python27\lib\json\decoder.py", line 380, in raw_decode obj, end = self.scan_once(s, idx) UnicodeDecodeError: 'utf8' codec can't decode byte 0x85 in position 94: invalid start byte

Ce programme n » t s'exécute plus de 3 secondes d'affilée, mais certains tweets sont écrits sur twitter-database.db jusqu'à ce qu'une exception se produise.

Also when looking at the trainer.py i saw this:

# TODO: Handle non-ascii characters properly 

Toutes les idées sur pourquoi cela se produit et comment puis-je résoudre ce problème?

Répondre