Things used in this project

Schematics

not a schematic...
Just to pass the validation.
The contest asked for a VUI diagram..I searched on internet and there is no mention about it..Also I have asked on twitter ( @dega1999 ) no responses :)
Ico max

Code

An xml to logically connect: XML
A file structure I built for my needs.
I feel it is complicated How to connect the piecese of an alexa skill.
This is a logical connection between the intent, utterances and team.
There is a python script that is able to parse this xml and produce a list of utterances.
<!-- Variables are with 2 #, like #field#. It will be replaced by <field> from the tool
     it will also extract ALL the utterance in a SampleUtterance.txt file

the user will be able to ask: match results, the next match of a team, the last result of a team
 -->

<utterances_groups>
<group>
	<description>No intent.. launch request</description> <!-- *** CHANGE DURING TIME -->
	<intent>NoIntent</intent>
	<utterance>give me some info</utterance>
	<utterance>how to use the skill</utterance>
</group>
<group>
	<description>Adversary of {Team}</description> <!-- *** CHANGE DURING TIME -->
	<intent>AdversaryOfTeamIntent</intent>
	<utterance>who are adversary of {Team}</utterance>
	<utterance>who will {Team} encounters</utterance>
	<utterance>who will {Team} play against</utterance>
	<utterance>who will be the opponent of {Team} play against</utterance>
</group>
<group>
	<description>The group for {Team}</description> <!-- **** -->
	<intent>GroupForTeamIntent</intent>
	<utterance>which is the group for {Team}</utterance>
	<utterance>in which group is {Team}</utterance>
</group>
<group>
	<description>Teams in a {Group}</description> <!-- **** -->
	<intent>TeamsInAGroupIntent</intent>
	<utterance>which are the teams for {Group}</utterance>
	<utterance>which are the teams for group {Group}</utterance>
	<utterance>teams for {Group}</utterance>
	<utterance>teams for group {Group}</utterance>
</group>
<group>
	<description>Teams in the cup</description> <!-- **** -->
	<intent>ListTeamsIntent</intent>
	<utterance>who are the teams in the cup</utterance>
	<utterance>which are the teams in the cup</utterance>
	<utterance>who are the teams</utterance>
	<utterance>list all the teams</utterance>
	<utterance>which are the teams</utterance>
	<utterance>give me the teams</utterance>
	<utterance>give me the cup teams</utterance>
	<utterance>give me the qualified teams</utterance>
</group>
<group>
	<description>The groups of the cup</description> <!-- **** -->
	<intent>ListGroupsIntent</intent>
	<utterance>which are the groups in the cup</utterance>
	<utterance>which are the groups</utterance>
	<utterance>list the groups in the cup</utterance>
	<utterance>give me the groups</utterance>
	<utterance>list all the groups</utterance>
</group>

<!--future release calls:
	- it responds with "Cup is not started yet! You can receive answer by" by default TODO
	- change previous dependency calls
-->
<!--<group>
	<description>Players for #Team</description>
	<utterance>EuroCup which are the players of #Team#</utterance>
</group>
<group>
	<description>When TheTeam Will play</description>--> <!-- *** CHANGE DURING TIME TODO LATER -->
<!--	<intent></intent>
	<utterance>when #Team# will play</utterance>
</group>

<group>
	<description>About today results</description>
	<intent></intent>
	<utterance>results for today</utterance>
	<utterance>who played today</utterance>
</group>
<group>
	<description>About today results</description>
	<intent></intent>
	<utterance>results for today</utterance>
	<utterance>matches for today</utterance>
	<utterance>who played today</utterance>
</group>
<group>
	<description>Last results</description>
	<intent></intent>
	<utterance>last results</utterance>
	<utterance>last matches</utterance>
	<utterance>last played matches</utterance>
</group>
<group>
	<description>About today results</description>
	<intent></intent>
	<utterance>results for today</utterance>
	<utterance>who played today</utterance>
</group>-->
</utterances_groups>
EuroUtils.jsJavaScript
Utility class used by the skill
'use strict';

var FRA = "France";
var ROM = "Romania";
var ALB = "Albania";
var SWI = "Switzerland";

var ENG = "England";
var RUS = "Russia";
var WAL = "Wales";
var SLO = "Slovakia";

var GER = "Germany";
var UKR = "Ukraine";
var POL = "Poland";
var NIR = "Northern Ireland";

var SPA = "Spain";
var CZR = "Czech Republic";
var TUR = "Turkey";
var CRO = "Croatia";

var BEL = "Belgium";
var ITA = "Italy";
var EIR = "Republic of Ireland";
var SWE = "Sweden";

var POR = "Portugal";
var ICE = "Iceland";
var AUS = "Austria";
var HUN = "Hungary";

//static informations! Enough for phase 1.
var groups = [ 
	["A",[FRA,ROM,ALB,SWI]],
	["B",[ENG,RUS,WAL,SLO]],
	["C",[GER,UKR,POL,NIR]],
	["D",[SPA,CZR,TUR,CRO]],
	["E",[BEL,ITA,EIR,SWE]],
	["F",[POR,ICE,AUS,HUN]]
];	

var matches= [ ["France","Romania","10 Jun"]]; //time missing...

function EuroUtils() {}

EuroUtils.prototype.allGroups = function() {
	var ggroups = [];
	for(var i=0;i<groups.length;i++)
		ggroups.push(groups[i][0]);
	if( ggroups.length === 0 ) 
		return false;
	return ggroups;
}

EuroUtils.prototype.formattedOutput = function(tteams) {
	var result = "";
	if(tteams.length===undefined)
		return "I don't know, sorry.";
	for(var i=0;i<tteams.length;i++) {
		result += tteams[i] + ",";
	}
	if(result.length===0)
		return "I don't know, sorry.";
	return result;
}

//return the group for the team passed... in string, or false.
EuroUtils.prototype.groupForTeam = function(theTeam) {
	for (var i=0;i<groups.length;i++) { // for each group
		if( groups[i][1].indexOf(theTeam) !== -1 ){ //check if the group contains the team
			return groups[i][0];
		}
	}
	return false;
};

//return the teams found for the group passed.. as an array of string, or false.
EuroUtils.prototype.teamsForGroup = function(groupLetter) {
	var theTeams = false;
	for ( var i=0;i<groups.length;i++ ) { // for each group
		if ( groups[i][0] === groupLetter ) //check if the group contains the team
			theTeams = groups[i][1];
	}
	return theTeams;
};

//return the adversary of team theTeam, or false if the theTeam is not found.
//SHOULD CHANGE AFTER 10 June.
EuroUtils.prototype.adversariesForTeam = function(theTeam) {
	var groupLetter = this.groupForTeam(theTeam);
	if( groupLetter !== false ) {
		var allTeamsInGroup = this.teamsForGroup(groupLetter);
		if(allTeamsInGroup !==false) {
			var tteams = [];
			for( var i=0;i<allTeamsInGroup.length;i++) {
				if( allTeamsInGroup[i] !== theTeam ) 
					tteams.push(allTeamsInGroup[i]);
			}
			return tteams;
		}
	}
	return false;
};

//return all the teams of the cup
EuroUtils.prototype.teamsForCup = function() {
	var theTeams = new Array();
	for ( var i=0;i<groups.length;i++ ) { // for each group
		for ( var j=0;j<groups[i][1].length;j++) {
			theTeams.push(groups[i][1][j]);
		}
	}
	if ( theTeams.length === 0 )
		return false;
	return theTeams.sort();
};


module.exports = EuroUtils;
A test classJavaScript
This class is used to test the "core" of the application.
It was extremely useful for minimize the error once the skill was submitted.
I also used to print all the teams to insert in a special custom slot.
var EuroUtils = require('./EuroUtils');

var euroUtils = new EuroUtils();
console.log("TEST 1: count teams");

var teams = euroUtils.teamsForCup();
if ( teams.length !== 24 ) {
	console.log("The number of teams is not 24!");
	return;
}

console.log("Listing teams...");
for(var i=0;i<teams.length;i++) {
	console.log("" + teams[i]);
}
console.log("***");

console.log("TEST 2: group for team Sweden");
var tempTeam = "Sweden";
var groupForTeam = euroUtils.groupForTeam(tempTeam);
if (groupForTeam !== 'E')
	console.log(""+tempTeam+ " found in wrong group: " + groupForTeam);

console.log("TEST 3: group for unexisting team");
tempTeam = "ABCDE";
var groupForTeam = euroUtils.groupForTeam(tempTeam);
if (groupForTeam !== false)
	console.log("Unexisting team ("+tempTeam+ ") found in a group... " + groupForTeam);

console.log("TEST 4: teams for group B");
var tempGroup = 'B';
var teamsForGroup = euroUtils.teamsForGroup(tempGroup);
var groupB = ["England","Russia","Wales","Slovakia"];

for(var i=0; i < groupB.length ; i++) {
	if(teamsForGroup.indexOf(groupB[i]) === -1) {
		console.log("Team " + groupB[i] + " not found on group B");
		for(var j=0;j<teamsForGroup.length;j++)
			console.log(teamsForGroup[j]);
		return;
	}
}

console.log("TEST 5: teams for unexisting group");

tempGroup = "ABCDE";
teamsForGroup = euroUtils.teamsForGroup(tempGroup);
if( teamsForGroup !== false) {
	console.log("Teams ("+teamsForGroup.length+") found for unexisting group");
	return;
}

console.log("TEST 6: adversary for team Sweden");
tempTeam = "Sweden";
adversaries = euroUtils.adversariesForTeam(tempTeam);
if( adversaries === false ) {
	console.log("Adversary for " + tempTeam + " not found..");
	return;
}
if(adversaries.length !== 3 ) {
	console.log("Adversary for " + tempTeam + " not 3!");
	for(var i=0;i<adversaries.length;i++)
		console.log(adversaries[i]);
	return;
}

if( adversaries.indexOf("Belgium") === -1 && 
	adversaries.indexOf("Italy") === -1 && 
	adversaries.indexOf("Republic of Ireland") === -1 ) {
	console.log("One of the adversary of Sweden is missing!");
	return;
}

console.log("TEST 7: adversary for unexisting team");
tempTeam = "ABCDE";
adversaries = euroUtils.adversariesForTeam(tempTeam);
if( adversaries !== false ) {
	console.log("Found adversaries for unexisting team!");
}

console.log("TEST 8: all groups letter");
var letters = euroUtils.allGroups();

if( letters.length !== 6 ) {
	console.log("Missing some letters..");
	for(var i=0;i<letters.length;i++) 
		console.log(letters[i]);
	return;
}

console.log("TEST 9: Formatted Output");
var lettersFormatted = euroUtils.formattedOutput(euroUtils.allGroups());
if ( "A,B,C,D,E,F," !== lettersFormatted ) {
	console.log("Wrong Output: [" + lettersFormatted + "]");
	return;
}
/**/

console.log("TEST 10: Formatted Output empty array");
if ( euroUtils.formattedOutput([]) !== "I don't know, sorry." ) {
	console.log("Error on empty input array");
	return;
}

console.log("ALL TESTS PASSED");
The Code of the skill
All the skill is implemented here in this repository: it obviously miss the key , in the index.js

Credits

Photo
Andrea De Gaetano

Interested in iot, mobile and security Love hackathons This is my blog http://pestohacks.blogspot.com

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

UK Treasure Hunt
Intermediate
  • 72
  • 4

Full instructions

Find Precious Treasures from across the United Kingdom..!

Run Google Assistant on Your Amazon Echo
Intermediate
  • 1,908
  • 14

Full instructions

This is an implementation of the Google Assistant API wrapped as an Alexa skill.

Parliament Election Support from you Alexa
Intermediate
  • 72
  • 3

Full instructions

Democracy calls! Use this Alexa skill for who is running for the UK Parliament on the snap election for the 8th of June, as well as who won.

Home Automation Using Wiscore and OpenHab
Intermediate
  • 279
  • 2

Protip

This project will help you setup your very own Alexa controlled Home Appliances using the wonderful Wiscore Module from RAK Wireless.

Unofficial Pokedex (Updated 06/2017) - Alexa Skill
Intermediate
  • 68
  • 3

This is an updated version: now the response card shows the Pokemon image and you are able to ask for the Pokemon's evolution.

Smart Pet Feeder
Intermediate
  • 477
  • 5

Work in progress

A smart pet that you can automate, control via Alexa, or even via a web site. Feed your pet any way you want!

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login