中文聊天机器人

cbot的Python项目详细描述


CBOT

一个中文聊天机器人

CBOT使用简介:

版本:0.1.0

####如何安装CBOT: #####PIP安装CBOT #####如果在安装python levenshtein包时出错 #####您可以下载.whl文件并安装此包:python-levenshtein ####如果您想在本地使用:

from cbot import CBot
cbot = CBot('cbotName')

# If you start from scratch
# cbot.train()
# while True:
#     que = input('me:')
#     reponse = cbot.get_response(str(que))
#     print('cbot:', reponse)


# If you want to train some data first
# The data set must be list type.
# And the next sentence is the answer to the last sentence.
trainList = [
    '早',
    '早上好',
    '早饭吃了么',
    '还没呢!,你呢?',
    '我也没吃',
    '我们一起吃早饭去吧',
    '好呀'
]

cbot.train(trainList)
while True:
    que = input('me:')
    reponse = cbot.get_response(str(que))
    print('cbot:', reponse)

####如果要与Turing API一起使用:

from cbot import CBot

cbot = CBot('felix')
cbot.turing_key = ''  # you should git an api key at http://www.tuling123.com/
while True:
    que = input('我:')
    reponse = cbot.get_response(str(que), api='turing')
    print('CBot:', reponse)

###现在玩得开心! ###如果你得到一个错误,你可以把错误发送到我的电子邮件。 ###这是我的电子邮件:felix2@foxmail.com

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
使用Selenium Java查找筛选器窗格“铅笔图标”的元素时出现问题   分布式缓存l2上使用infinispan和hibernate的java连接锁   使用Java的DOM XML API解析XML中的符号和   java是解析和操作字符串的有效方法   java发布NewRelicMeterRegistry时如何过滤仪表   多维数组在java中读取文件后将数据值分组   java如何将httpClient配置为jsoup   java BreakIterator在Android中是如何工作的?   找不到maven GAE类:原因:java。lang.ClassNotFoundException应用程序标识cRedential$AppenginecRedential包装   Jlabel调整java大小   调试如何在VScode中的java类依赖项中设置断点   java正在获取文件夹名,而不是。mp3文件{Android}   java如何将从DiffieHellman类生成的AES密钥添加到使用该密钥的类