I want to develop a conversational chatbot for chinese language in python like the user says "你好" which means "hello" in chinese and chatbot respond. i think it will be very difficult to build from scratch and write every expected response for chatbot. i want to find an opensource library to connect with my API which is able to respond to user and do the conservation with the user. i already know about a chatbot developed by Microsoft called "Xiaobing" which is especially developed for chinese people but i don't know if they provide an API for developers or not.There is also another github project called brobot(https://github.com/lizadaly/brobot/) but i don't know if it provide chinese language support. Any suggestions or guidance from anyone here would be appreciated.
Have a look at ChatterBot Python module. It is language independent. Means you can train it with any language. sample snippet to train your bot.
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
chatbot = ChatBot("bot") # create an instance of ChatBot and name it.
chatbot.set_trainer(ListTrainer)
data = ["你好",
"我很高兴认识你"] # add data for training
chatbot.train(data) # train the bot
while True:
try:
user_input = input("you - ") # ask something to bot
bot_input = chatbot.get_response(user_input) # get curresponding output from bot
print("bot - ",bot_input)
except(KeyboardInterrupt, EOFError, SystemExit):
break
output:
List Trainer: [####################] 100%
you - 你好
bot - 我很高兴认识你
You can train it with more and more conversations. Just add those conversation in a text file and train with it. Refer ChatterBot docs for further information on training the data.