微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

为什么 chatterbot 会为我的自定义语料库引发 TypeError?

如何解决为什么 chatterbot 会为我的自定义语料库引发 TypeError?

昨天,我发现了 chatterbot,它可以让你创建机器人,所以在我安装了 chatterbot-corpus 之后,我用 chatterbot.corpus.english 训练了聊天机器人。然后我尝试用我的自定义语料库训练它,但是当我尝试训练它时,它引发了这个错误

  File "<pyshell#68>",line 1,in <module>
    trainer.train('chatterbot.corpus.custom')
  File "C:\Users\Admin\AppData\Local\Programs\Python\python36\lib\site-packages\chatterbot\trainers.py",line 154,in train
    statement_search_text = self.chatbot.storage.tagger.get_bigram_pair_string(text)
  File "C:\Users\Admin\AppData\Local\Programs\Python\python36\lib\site-packages\chatterbot\tagging.py",line 21,in get_bigram_pair_string
    if len(text) <= 2:
TypeError: object of type 'bool' has no len()

这是我的聊天机器人代码的样子:

from chatterbot import chatbot
from chatterbot.trainers import chatterbotCorpusTrainer
chatterbot = chatbot('test')
trainer = chatterbotCorpusTrainer(chatterbot)
trainer.train('chatterbot.corpus.custom.random')

random.yml 看起来像这样:

categories:
- random
conversations:
- - r u gae
  - not as gae as you
  - no
- - ye
  - nuu
- - 1 + 1 =
  - the largest value that can be expressed as an exponential function
- - you are dumb
  - yes,but not as dumb as you

我用我制作的另一个自定义语料库对此进行了测试,并且以某种方式起作用。如何修复此错误

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。