Client: Internal project
Length: 3 months
Demo: Chatbot demo
The general idea was to create a chatbot that would be able to collect a user's information while conversing with him. The bot should be able to recognize the user’s name, location, contact information, and to forward the user’s message to the target person in the company.
The approach we followed for creating the chatbot app included defining the states, architecture and algorithms that were going to be used for data extraction. The program architecture was designed with scalability and interoperability in mind. Considering that chatbot is implemented as a state machine, introducing new conversational statements to the conversation flow is as easy as creating a new state and registering it in the list of available states.
We introduced states as a way of constructing a conversation flow. Each state has its own rule and states can be easily rearranged, added, removed or modified. For information extraction, we used a number of NLP algorithms. Name extraction was implemented using the Stanford Named Entity Recognizer library by extracting named entities that are tagged as ‘PERSON’. For location detection, we extracted named entities from a sentence. By using the geopy library we were able to detect location, find its coordinates and output the closest SmartCat office. Detecting the user’s email or phone number was done by implementing simple regular expressions and matching words from the user’s message to a defined pattern. The most challenging task was finding a team member that should be contacted regarding the user’s inquiry. All team members defined an arbitrary number of keywords that describe them. Using DBpedia, we extracted more information on these keywords and using the RAKE algorithm we extracted additional keywords from wikipedia articles. We also applied weights to keywords to differentiate between those who describe team members better than the others. Finding the person of interest includes comparing keywords from all team members with keyboards extracted from the user’s messages. At any point, the user is able to change any information he provided.
We created a chatbot that is able to collect user information. Each conversation made with the chatbot is saved as a JSON file and available for future use (e.g. training a neural network).