We had our group 24 hour Hackathon recently, and one of the big themes which a lot of the teams chose to work on was Chat Bots. Our Team, Piggy Wizard, created a Chat Bot using the Microsoft Bot Framework to search for products on the website using natural language through Facebook messenger. Our Bot could also automatically understand which language the user was typing and translate it’s responses in to their native language.
Our code was deployed as an Azure App Service and needed to integrated with 3 Microsoft APIs and our own Search Service.
- Bot Framework adapts messages from a variety of clients and proxies them to your service
- LUIS Language Understanding and Intelligence Service which uses machine learning to provide Intents discovered from messages received
- Translator provides translations from 60 languages, (including 2 versions of Klingon!)
The application flow starts with receiving a message from the Bot Framework which has been proxied from one of the clients, such as Facebook messenger, Slack, or your own custom built front-end. On receiving a message our App Service will ask the Translator which language the message is written in. If the language is not English, then it is converted into English. Then the LUIS framework is called to figure out the Intent of the message, which could be greeting or product search. Also LUIS can extract entities from the message and categorise them. For example I want a card for my mum would extract card as the product, and mum as the recipient. LUIS provides an interface for non-developer to create this model of Intents and entities to build out a domain which the Chat Bot can understand. Also the machine learning can be trained to predict Intents from new inputs, given enough data, so phrasing the question differently e.g. I’m looking for a gift for my brother, would also be categorised as the product search intent with the appropriate entities.
The entities could then be used to make the call to our Search Service return more relevant results. Finally if the message was not sent in English, then output text would be translated back into the original language for the user to read in their own language. And that’s Piggy Wizard!