First thing, What is a chatbot?
It is a computer program that can have a conversation with you. It must know about the topics you are going to have a conversation about.
So, can I build a chatbot that knows everything?
For that to happen, a program must be able to process all the worlds knowledge in no time. At the state when machine achieves Singularity, only then it is possible. According to the visionary Ray Kurzweil, this will happen as soon by 2045.
2045 is quite far away. What are the options available right now?
There are many options available currently. It really depends on your requirements.
This answer seems vague. So, lets explore the scenarios and you can choose what might be right for you.
Scenario I: You don’t have a knowledge in AI and want to build a general chatbot.
AIML is your answer. Here, you must provide with the questions and answers to the bots. The good thing here is that you can have the questions in the form of patterns and utilize that in answer.
For example, (Just for intuition. Not exact code, refer to AIML tutorials)
- <question>Hello *</question>
- <answer>Hello Friend, I am a bot</question>
Here, those questions which starts with Hello will have the same answer.
Another example,
- <question>*</question>
- <answer>I currently don’t have an answer for that</answer>
You can make sure that the bot returns some answer by having asterik as a question.
With these examples you can infer that you need to prepare a questions according to your requirements.
Scenario II: You don’t have a knowledge in AI and want to build a specialized chatbot
If you are building a chatbot for your business and want to get started quickly, look into Googles’ DialogFlow (previously api.ai) or Facebooks’ Wit.ai.
There isn’t more to say about this. You can easily implement text, voice based chatbot with just a few clicks. Refer to the respective tutorials for getting started with these.
Scenario III: You have a sufficient knowledge in AI and want to build a generalized chatbot
Using a sequential neural network is your answer.
You must have a lot of conversation data for this to work. Otherwise, the answers might seem garbage. Thus, I suggest to collect and clean the data properly before training.
Here’s a great demo by Mike Pound in Computerphile. By the way, one of the best channels in YouTube. Do See to have an intuition.
You can use similar concept and train it on movie dialogues. It will be a fun project.
Scenario IV: You have a sufficient knowledge in AI and want to build a specialized chatbot
If you really are willing to make your hands dirty and want to do it all for what it takes to build a specialized chatbot.
Such chatbots are similar to aforementioned dialogflow and wit.ai, but every component is built by you. Diving deep and building it yourself is a great way to understand how current chatbot system works.
Look into an opensource project, RasaHQ/rasa_nlu. It really is a great project. It gives you knowledge about how to fit different components together to build a proper working chatbot.
You can also read our research paper on Web Virtual Assistant. It aims to create a chatbot for any website using static content (web scraping) and a dynamic content (a semantic database).