When you design a voice interface for an application, you face new problems. Traditional interfaces, like GUI and command-based ones, rely on the structured user input. A voice interface, however, implies that users will interact with the application by giving commands in the spoken language. You need to make sure the application interprets the user input correctly and does exactly what the user expects.
In the voice-enabled communication, Alan acts as an intelligent intermediary between users and the application. Using technologies like machine learning, artificial intelligence and natural language processing, it handles the main conversation challenges and allows the application to ‘understand’ the spoken language. And your role is to build the correct conversation flow for your application.
In Alan, the conversation flow is created with the help of voice scripts written in the Alan Studio. A voice scripts describes the structure of the dialog with the user, or the expected conversation scenario. You can use the following Alan objects and entities to create the voice script for your system.
The voice script consists of voice commands such as intents, follows and questions. You can think of a voice command as a new turn in the conversation. A typical command includes the following components:
- Patterns: phrases the user can say
- Reply or action: a phrase with which the application can reply or an action the application can take in response
When the user says something, Alan matches the user utterance to the best command in the voice script and gives the reply and/or performs the action provided in this command.
To guarantee a high-quality conversational experience, Alan allows you to use slots in voice scripts. Here are some scenarios in which slots can be helpful:
- Retrieve from the user input the information required for the conversation flow and commands execution, like date, time or number
- Describe different variants of phrases the user can say
- Get close matches to user utterances
Just like in real world conversations, in voice scripts some user commands may have meaning only within a context. For example, the user can say: 'What is the temperature now?' To answer this question in the best way, you need to understand the situation to which the user is referring: at least know the user location.
In Alan, contexts allow you to control the conversation flow and keep track of where the user is in the dialog. You can use contexts if you create a voice script for a multi-step conversation where some conversation turns can take place only in specific circumstances. In this case, you can place some part of the user dialog in a context and pass to this context (activate it) when the user says a certain phrase or gets to a certain step in the dialog. For example, when designing a voice interface for an online store, you may want to create a context for getting the user address details and activate this context only after the user initiates the checkout process.
To achieve greater control over the conversation flow during the voice script execution, you may need to exchange data between the voice script and application or within the voice script itself. Alan provides you with several methods to do this:
- To communicate some data from the application to the voice script, you can use the projectAPI or visual state object
- To share data between different contexts in the voice script, you can use userData and state objects
- Or, in case your Alan Studio project contains multiple voice scripts and you want make some data accessible for all voice scripts, you can use the project object.