A simple chatbot Using Chatterbot part 02

shrimali senevirathna
3 min readJun 17, 2020

--

Fifth step cont….

In the chatbot Using Chatterbot part 01 steps, we created our first chatbot and we could ask some questions but sometimes it doesn't have the answer. If so if we are put a new entry it stores it and when we try next time it replies well. So how the bot can do this?

As you can see in the code example, it shows how to train the chatbot using the chatterbot ListTrainer.The first it starts training the bot with the chatterbot corpus data and then next we can train with lists of data to add response variations after that when we ask the question it responds with the correct answer!

So next change your code as below to check how the chatterbot corpus trainer works...

In this code, you can see that it is training the chatbot using the English corpus. This class contains a bunch of conversations. You can check this out from the link here.

If we go here we can see the speciality of this as we can use many languages to train our bot! Since people from all around the world use this technology it is better to have multilingual chatbots.

So if you want to train your bot in Spanish or any other language, it is not hard. We can do it easily. change the code in the corpus class as given below.

trainer.train(“chatterbot.corpus.English”) #change here English to any other language and run the program!

Now our chatbot is a Spanish chatbot and it is trained based on the Spanish corpus.

So we discussed how to make a simple chatbot from the chatterbot library and I think you got and idea and you could make it right! But as we know, companies are using chatbots as a helper so it should have the ability to communicate with what the customer tells to the bot. How we can make more complex chatbots which can respond easily to anything.? There are a lot more new technologies based on advanced machine learning concepts and many other concepts…

--

--