问题描述
昨天,我发现了 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 (将#修改为@)