Personal Artificial Intelligence (AI) assistants are becoming an increasingly common interactive tool and developing them is becoming easier with the tools that are now available. I have previously talked about voice-based personal assistants, and now want to take a look at text-based personal assistants (also known as chatbots). Chatbots utilize machine learning algorithms to provide appropriate responses, and as a practical application of AI, I think it’s an interesting tool to consider using in your development.
Similar to voice-based personal assistants, Chatbots allow you as developers to incorporate a conversational experience with your user. However, chatbots rely on text and sometimes images for the conversation rather than verbal communication. Chatbots provide an optimal user experience when they are integrated into areas that are familiar and most useful to your users such as text messaging, messaging platforms, email and on websites. These interactions can take the form of self-help customer service requests, language training tools, and even Internet connected toys for children.
From bots to chatbots
Not all bots are intelligent. They vary from those that are based on a simple set of rules to those that offer complex conversations using advanced machine learning.
Simple scripted bots might scan text for specific keywords, such as “address” or “contact” in an attempt to offer a self-help service to locate a store. This can lead to some confusing user interactions if someone wants to “ship contact lenses to my home address” and is instead offered the address of the store.
If we are dealing with a specific problem, such as collecting user data to renew a passport, you could program your bot to handle only those related queries and deny the rest. These programs are fairly easy to implement, but are limited in scope and can therefore be frustrating to the end user. Furthermore, making changes to these programs and adding new commands can be quite time consuming as they require a programmer who understands AI and machine learning development.
To reach the level of an intelligent chatbot, a complex text analysis needs to be undertaken at runtime to understand the context of the words the user has typed. This level of processing can be accomplished using AI machine learning. By talking to people and remembering their responses, the chatbot algorithms can learn to become more human-like. If you’re new to machine learning then check out our eBook to help you get up to speed.
Natural Language Processing
Whether you’re making a simple bot or complex chatbot for your AI assistant, Natural Language Processing (NLP) plays a key role. NLP is the method by which the AI extracts meaning from text:
- The text is tokenized and broken up into individual words
- Part-of-Speech tagging is used to categorize the words as nouns, verbs, adjectives, etc
- Statistical models, such as Hidden Markov Models and Conditional Random Fields, are used to predict the meaning of each word
- Dependency relations are built between the words using a parser tree to reduce ambiguity
- An action is deduced from the previous predictions and passed to the algorithm that handles it
Natural language generation
Once the AI has determined how it is going to respond it needs to generate an answer and send it back to the user as a response. This is a much more straightforward task compared to NLP:
- The results are scanned to determine which content to disseminate. Not all information may be meaningful to the end user
- The selected results are organized into a tree structure to determine how to generate a response
- Lexical choices are made to ensure that the verb tense and nouns are well formed
- The previous choices are combined into a final sentence which is returned to the user
Machine learning requires a lot of computing power, but libraries like the Qualcomm Neural Processing Engine can help harness the power of your mobile platform to make chatbot interactions responsive.
If you’re looking for more information, you can check out a few best practice recommendations from Facebook.