Alexa is Amazon’s voice service
and the brain behind tens of millions of devices like the Amazon Echo, Echo Dot, and Echo Show. Alexa provides capabilities, or skills, that enable customers to create a more personalized experience. It is capable of voice interaction, music playback, making to-do lists, setting alarms, streaming podcasts, playing audiobooks, and providing weather, traffic, and other real-time information, such as news. Alexa can also control several smart devices using itself as a home automation system. Users can extend the Alexa capabilities by installing "skills" (additional functionality developed by third-party vendors, in other settings more commonly called apps).
- This project is based on the custom alexa skills that have been created on scanning and querying the IPL dataset (https://www.kaggle.com/manasgarg/ipl/data). The dataset consists of statistical analysis of all the matches ever played in the IPL upto season 10 (2017). In the project the custom skills have been programmed using the
node express
framework. The user requires an alexa enabled device like Amazon Echo, Echo Dot and Echo Show to interact with the skill. - The project also contains a cross platform mobile app based on the
react-native
framework. This app contains a log of defined intents, their utterances and the respective response alexa will give. This app can serve as a companion for the user to effectively interact withalexa
.
- The link to the mobile app can be found here. IPLAlexaSkill.
- Follow the steps to get it running on your device: get the steps to setup here.
Any project on hasura.io/hub can be cloned and deployed. In fact, this alexa-ipl-skill is a hasura project itself.
Step 1: Install the hasura CLI: installation instructions
Step 2: Create a hasura project on your machine
$ # 1) Run the quickstart command
$ hasura quickstart anishsamant/alexa-ipl-skill
Step 3: Deploy the project to your free cluster!
$ # 2) Git add, commit & push to deploy to your cluster
$ cd alexa-ipl-skill
$ git add . && git commit -m 'First commit'
$ git push hasura master
Note: Your free cluster got automatically created when you ran the quickstart
command.
This alexa-ipl-skill
project contains a sample data schema and some sample data (files in migrations
) and a simple microservice in nodejs (microservices/www
). When you ran the git push
these tables and a microservice and even a subdomain to access your microservice all
got created.
In the next few steps you'll be browsing the instant Hasura APIs and exploring the custom microservice too.
The hasura CLI gives you a web UI to manage your data modelling, manage your app users and explore the Hasura APIs. The API explorer gives you a collection of all the Hasura APIs and lets you test them easily.
Access the api-console via the following command:
$ hasura api-console
This will open up Console UI on the browser. You can access it at http://localhost:9695.
You can know more about the hasura cli here.
- You can test out this skill using an Amazon Echo device or at Echosim (Web Browser) or at Reverb (Android/iOS). The workflow is as follows:
- You invoke the skill saying "Alexa, start IPL Search".
Currently we have 5 types of queries that can be invoked
1. About IPL:
sample invocation -What is Indian Premier League
2. Total Matches:
sample invocation -What is the total number of matches played ever in IPL
3. Season Winner:
sample invocation -Who was the winner of IPL season 2017
4. Welcome message:
sample invocation -hello
5. Exit:
sample invocation -close alexa ipl skill
Note: We will iteratively add more intents to the skills, which will be introduced in later releases.
-
Go to Amazon developer console.
-
Login with your amazon credentials and select the
ALEXA
Tab on top. -
Click on
Get Started >
for Alexa Skills Kit.
- Click on
Add a New Skill
.
- Call the skill
IPL search
and give the name asipl search
.
Note You can give any name. We have given ipl search for our skill.
Click Next.
6. In the interaction model go to </> Code Editor and paste the below intent schema.
{
"languageModel": {
"intents": [
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": []
},
{
"name": "AMAZON.StopIntent",
"samples": []
},
{
"name": "helloIntent",
"samples": [
"say hello",
"hello",
"hi"
],
"slots": []
},
{
"name": "iplDefinitionIntent",
"samples": [
"what is indian premier league",
"what is ipl",
"what this skill is all about"
],
"slots": []
},
{
"name": "iplFinalWinner",
"samples": [
"Who won ipl season {season}",
"Who was the winner of ipl season {season}"
],
"slots": [
{
"name": "season",
"type": "AMAZON.NUMBER"
}
]
},
{
"name": "iplTotalMatches",
"samples": [
"what is the total number of matches played ever in IPL",
"what is the total number of matches played ever in indian premier league",
"how many matches played by teams in ipl",
"what is the total number of matches played in IPL"
],
"slots": []
},
{
"name": "thanksIntent",
"samples": [
"goodbye",
"bye",
"tata",
"stop",
"thanks",
"exit",
"close",
"close alexa ipl skill",
"quit",
"shutdown"
],
"slots": []
}
],
"invocationName": "ipl search"
}
}
Note You can define your own intents.
-
Click on
Apply Changes
and click theBuild Model
button. -
Under
Configuration
section, for the service endpoint, check the HTTPS radio button.
Put the default URL ashttps://www.<cluster-name>.hasura-app.io/ipl.
(Run$ hasura cluster status
from root directory to know your cluster name).
Click next.
-
About SSL certificates, Hasura services have auto generated LetsEncrypt Grade A SSL certificates. This means, you have to check the radio button that says My development endpoint has a certificate from a trusted certificate authority.
Click next. -
And you are done. You can test your skills in the
Test
section.
This skill is written in Node Express. The Implementation is as follows:
- When you make a particular type of query, an appropriate intent from the skill set is invoked and then the relevant method mapped to that intent is called from the node express script, which fetches the results from the matches database. A response string is generated using fetched data, which is spoken out by Alexa.
- If Alexa is not able to recognise the spoken words or if there exists no results based on the parameters passed, Alexa will humbly respond and ask you to try again.
- Github Project:- http://github.com/anishsamant/IPLAlexaSkill
- .apk file:- IPLAlexaSkill
(keep coming back for new version. Current: 03/03/2018)
The app is based on the custom alexa skills that have been created on scanning and querying the IPL dataset (https://www.kaggle.com/manasgarg/ipl/data). The dataset consists of statistical analysis of all the matches ever played in the IPL upto season 10 (2017). This mobile app shows a list of defined intents, their utterances and the respective response that alexa will give. Currently there are 5 intents defined and the app provides the valid utterances for each one of them. This app works as a guide for the user to effectively interact with the alexa enabled device.
Currently 5 intents have been defined:
- Welcome Message
- About IPL
- Total Matches Played
- Season Winner
- Exit message
-- Follow the steps as mentioned in "Getting Started" section of react-native website in the "Build with native code" tab
-- https://facebook.github.io/react-native/docs/getting-started.html
$ git clone https://github.com/anishsamant/IPLAlexaSkill
$ cd IPLAlexaSkill
$ npm install
$ # (for android)
$ react-native run-android
OR
$ # (for ios)
$ react-native run-ios
$ # This will run the app on your connected emulator or development device
- The skill is invoked by saying "Alexa, start IPL search".
- If the asked question matches with the defined utterances, Alexa will give the respective response.
- What is Indian Premier League
Response: The Indian Premier League (IPL), officially Vivo Indian Premier League for sponsorship reasons, is a professional Twenty20 cricket league in India contested during April and May of every year by teams representing Indian cities.
If you happen to get stuck anywhere, please mail us at [email protected] or [email protected]. Alternatively, if you find a bug, you can raise an issue here.
If you happen to get stuck anywhere, please mail us at [email protected] or [email protected]. Alternatively, if you find a bug, you can raise an issue here.