This is a project containing a primary task and a framework of tasks to flesh out according to the user's desire.
The main task takes a natural phrase as input and retrieves normalized information about it from the Maluuba api.
Setting Up
The Maluuba api is fully online. You don't need anything extra on your android, but you also can't use it offline. You will need to get an api key from the Maluuba developer's page. Simply sign up with the link in the top right corner here:
Then, add an "app," which can be called anything you like, here:
You'll instantly get an api key, which needs to be placed in the step to set %api. There's a great deal of info on the dev page about the available categories and actions.
The first step in the task sets %phase. You'll need to give it an input. I chose to use a global, but you can send it a parameter from a calling task, use a GetVoice, or feed it from a plugin like AutoVoice.
CAUTION!
This task, as written, clears all variables beginning with NLP. If you are using any variables that match this, they will be cleared. You'll need to rework the variables in this task to prevent that.
What You Get.
Once you run the main task with a phrase, it will output a group of global variables.
%NLP_CATEGORY will contain values such as "call", "search", "transit", or "social".
%NLP_ACTION will contain more specific values such as "CALL_DIAL", "SEARCH_GOOGLE", or "SOCIAL_FACEBOOK_SHOW_WALL". These will be the result you want given the input phrase.
%NLP_ENTITIY_* will be variables for more information about the desired task. They may contain a list of contacts, dates, times, search phrases, and many other pieces of info. Because of the way they are enumerated, they are all arrays, even if they have only one value.
Once the variables are set, it launches a task named %NLP_CATEGORY_%NLP_ACTION. Tasks for all the current actions are provided in the project. They simply contain a toast to remind you to set up the task and a label with the entities that may be set for the task. In the future, I would like to build up a library of these tasks.
The task call_CALL_DIAL contains a small example for dealing with contacts, as they may be aliases, names, or phone numbers.
Download
Have fun!
- hawkjm73