What framework can I start with to create a simple chatbot? the focus of the bot is very limited(for my project management website http://ayeboss.com).
One can compare it with SIRI on iPhone. I want to create a simple "answering" chat which will answer questions like "give me all completed tasks so far" or "show me last completed task" or "show|list|give me my pending tasks" etc. After user asks the question I want to present the data to the user
As of now I am creating a regex dictionary of possible questions and if there is no match then I do a lucene search to find the nearest match. Am I doing it right?
Typically, chatbots within a narrow field like yours typically rely on 2 important concepts:
For your specific type of chatbot, which has a definite goal of retrieving list of completed tasks and retrieving the last completed task. To develop this, you need to define the intents of interest. From you examples we can easily define 2 intents:
COMPLETED_TASKS_REQUEST
LAST_COMPLETED_TASK
Based on this 2 intents, there is really no entity to be detected. You simply query your service API to retrieve the requested information in each scenario.
The next phase will be to train a classifier to identify the intents. This can be done by getting some sample sentences for each request type and training over those.
The flow is then reduced to the following:
Note that if you're not into Machine Learning or NLP you can easily train an intent detector on platforms like wit.ai or api.ai and the entity classification part of this task will be reduced to simple http
API requests. Though when building genuinely complicated or sophisticated bots it is almost always better to build your own models since you can have full control and can handle edge cases better. Platforms like wit.ai or api.ai generally need to perform well across multiple fields while you can focus on making yours an expert in task management.
Hope this helps.
PS: To make your bot more interesting we can add one more intent like retrieving the status of a specific task given the id. E.g a user can ask what is the status of task 54. This intent can be called:
TASK_STATUS_REQUEST
. In this example, the intent has an entity which is the id of the requested task so you will need to extract that :)
This is a NLP task, and for building a system like this require lot of R&D. You can start by building a set of question that might be asked. Analyzing the questions and coming up with word patterns for each type of question. The next step would be to transform the English sentence into some form of formal structure( maybe SQL or lambda calculus). The backend DB should have the data stored in it which can be queried by the formal language.
The main problem lies in converting the English sentence to a formal language. You can start with regex and progress to make it more complex by checking Part of Speech, Syntactic structure of input sentences. Check out NLTK package for doing NLP tasks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With