0

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.

Tehseen
  • 115
  • 2
  • 14

1 Answers1

1

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.

Mufeed
  • 3,018
  • 4
  • 20
  • 29
  • thanks. i understand it now but how to find training data for chinese language? because it will need a lot of work and will waste a lot of time if i write responses for bot – Tehseen Jul 03 '18 at 02:42
  • 1
    Yes. I agree. Collection of data is the the hardest part. But any chat bot you come across needs data. You can not find a single chat bot working without training with data. – Mufeed Jul 03 '18 at 04:47
  • thank you for your cooperation – Tehseen Jul 03 '18 at 06:08