T RUTH PUSHPA LATHA
Created June 30, 2017

CHRISTMAS FACTS

Is Christmas on December 25 or January 6??A great skill that tells you what the Real Christmas is all about?

29
CHRISTMAS FACTS

Things used in this project

Story

Read more

Schematics

Christmas Facts Visual User Interface

This shows you how the skill works.

Code

THE CODE

Pascal
/* eslint-disable  func-names */
/* eslint quote-props: ["error", "consistent"]*/
/**
 * This sample demonstrates a simple skill built with the Amazon Alexa Skills
 * nodejs skill development kit.
 * This sample supports multiple lauguages. (en-US, en-GB, de-DE).
 * The Intent Schema, Custom Slots and Sample Utterances for this skill, as well
 * as testing instructions are located at https://github.com/alexa/skill-sample-nodejs-fact
 **/

'use strict';

const Alexa = require('alexa-sdk');

const APP_ID = undefined;  // TODO replace with your app ID (OPTIONAL).

const languageStrings = {
    'en': {
        translation: {
            FACTS: [
               '1870 - The year Congress made Christmas a national holiday under President Ulysses S. Grant.',
'3 point 5 – The number of hours it took each day to apply and remove make-up on Jim Carrey in the movie How the Grinch Stole Christmas.',
'1963 – The year Andy Williams released the song, Its the Most Wonderful Time of the Year.',
'14 – The average number of gifts a lucky child receives over Christmas.',
'20 point 3 – The average number of presents a woman wraps in a typical December holiday season.',
'9 point 9 – The average number of presents that a man wraps in a typical December holiday season.',
'74 – The percentage of adults who said that the female head of the household would be most likely to wrap all of the familys presents.',
'27 – The percent of people who wrap their holiday gifts to others only one or two days before giving the present away. ',
'$830 – What the average American will spend on Christmas-related purchases this year, up 15 percent from $720 last year. ',
'95 – The percent of Americans who celebrate Christmas.',
'18 point 2 – The percent of U.S. households that display a real tree.',
'7 point 7 – The percent of Americans who say smell is the most important factor when choosing a Christmas tree.',
'47 – The percent of Americans who attend church on Christmas Eve, Christmas Day, or another special service during Christmas week. ',
'75 point 5 – The approximate size in feet of the tree at Rockefeller Center.',
'40 – The percent jump in suicide rates after Christmas.',
'2 point 7 million – The number of candy canes that the Spangler Candy Co. manufactures each day.',
'1901 – The year the world’s first Christmas tree farm was planted in New Jersey.',
'30 million – The approximate number of real Christmas trees that are sold each year.',
'15000 – The number of Christmas tree farms in the U.S.',
'100000 – The number of people who work full-time or part-time on a Christmas tree farm.',
'335 – The number of Christmas trees that two men stole in Arlington, VT in early December.',
'91 point 8 million – The number of houses Santa will visit on Christmas.',
'822 point 6 – The number of visits Santa has to make per second on Christmas in order to reach every household.',
'650 mps – The speed that Santa’s sleigh must travel to make all of those visits, which is over 3,000 times the speed of sound.',
'1955 – The year the North American Aerospace Defense Command (NORAD) created the Santa Tracker.',
'912 – The year the U.S. Postal Service provided an address for Christmas wish lists. The USPS estimates that it receives millions of letters to Santa every year.',
'1 point 5 billion – The number of Christmas cards that Americans send annually.',
'15 point 8 billion – The number of cards, letters and packages that the USPS delivers each year between Thanksgiving and Christmas Eve.'
     ],
            SKILL_NAME: 'Christmas Facts',
            GET_FACT_MESSAGE: "Here's your fact: ",
            HELP_MESSAGE: 'You can say tell me a Christmas Facts, or, you can say exit... What can I help you with?',
            HELP_REPROMPT: 'What can I help you with?',
            STOP_MESSAGE: 'Goodbye!',
        },
    },
    'en-US': {
        translation: {
            FACTS: [
               '1870 - The year Congress made Christmas a national holiday under President Ulysses S. Grant.',
'3 point 5 – The number of hours it took each day to apply and remove make-up on Jim Carrey in the movie How the Grinch Stole Christmas.',
'1963 – The year Andy Williams released the song, Its the Most Wonderful Time of the Year.',
'14 – The average number of gifts a lucky child receives over Christmas.',
'20 point 3 – The average number of presents a woman wraps in a typical December holiday season.',
'9 point 9 – The average number of presents that a man wraps in a typical December holiday season.',
'74 – The percentage of adults who said that the female head of the household would be most likely to wrap all of the familys presents.',
'27 – The percent of people who wrap their holiday gifts to others only one or two days before giving the present away. ',
'$830 – What the average American will spend on Christmas-related purchases this year, up 15 percent from $720 last year. ',
'95 – The percent of Americans who celebrate Christmas.',
'18 point 2 – The percent of U.S. households that display a real tree.',
'7 point 7 – The percent of Americans who say smell is the most important factor when choosing a Christmas tree.',
'47 – The percent of Americans who attend church on Christmas Eve, Christmas Day, or another special service during Christmas week. ',
'75 point 5 – The approximate size in feet of the tree at Rockefeller Center.',
'40 – The percent jump in suicide rates after Christmas.',
'2 point 7 million – The number of candy canes that the Spangler Candy Co. manufactures each day.',
'1901 – The year the world’s first Christmas tree farm was planted in New Jersey.',
'30 million – The approximate number of real Christmas trees that are sold each year.',
'15000 – The number of Christmas tree farms in the U.S.',
'100000 – The number of people who work full-time or part-time on a Christmas tree farm.',
'335 – The number of Christmas trees that two men stole in Arlington, VT in early December.',
'91 point 8 million – The number of houses Santa will visit on Christmas.',
'822 point 6 – The number of visits Santa has to make per second on Christmas in order to reach every household.',
'650 mps – The speed that Santa’s sleigh must travel to make all of those visits, which is over 3,000 times the speed of sound.',
'1955 – The year the North American Aerospace Defense Command (NORAD) created the Santa Tracker.',
'912 – The year the U.S. Postal Service provided an address for Christmas wish lists. The USPS estimates that it receives millions of letters to Santa every year.',
'1 point 5 billion – The number of Christmas cards that Americans send annually.',
'15 point 8 billion – The number of cards, letters and packages that the USPS delivers each year between Thanksgiving and Christmas Eve.'
            ],
            SKILL_NAME: 'American Christmas Facts',
        },
    },
};

const handlers = {
    'LaunchRequest': function () {
        this.emit('GetFact');
    },
    'GetNewFactIntent': function () {
        this.emit('GetFact');
    },
    'GetFact': function () {
        // Get a random space fact from the space facts list
        // Use this.t() to get corresponding language data
        const factArr = this.t('FACTS');
        const factIndex = Math.floor(Math.random() * factArr.length);
        const randomFact = factArr[factIndex];

        // Create speech output
        const speechOutput = this.t('GET_FACT_MESSAGE') + randomFact;
        this.emit(':tellWithCard', speechOutput, this.t('SKILL_NAME'), randomFact);
    },
    'AMAZON.HelpIntent': function () {
        const speechOutput = this.t('HELP_MESSAGE');
        const reprompt = this.t('HELP_MESSAGE');
        this.emit(':ask', speechOutput, reprompt);
    },
    'AMAZON.CancelIntent': function () {
        this.emit(':tell', this.t('STOP_MESSAGE'));
    },
    'AMAZON.StopIntent': function () {
        this.emit(':tell', this.t('STOP_MESSAGE'));
    },
};

exports.handler = function (event, context) {
    const alexa = Alexa.handler(event, context);
    alexa.APP_ID = APP_ID;
    // To enable string internationalization (i18n) features, set a resources object.
    alexa.resources = languageStrings;
    alexa.registerHandlers(handlers);
    alexa.execute();
};

utterances

Tex
GetNewFactIntent a fact
GetNewFactIntent a chrsitmas fact
GetNewFactIntent tell me a fact
GetNewFactIntent tell me achrsitmas fact
GetNewFactIntent give me a fact
GetNewFactIntent give me a chrsitmas fact
GetNewFactIntent tell me a trivia
GetNewFactIntent tell me a chrsitmasn triia
GetNewFactIntent give me a trivia
GetNewFactIntent give me a chrsitmas trivia
GetNewFactIntent give me some information
GetNewFactIntent give me some chrsitmas information
GetNewFactIntent tell me something
GetNewFactIntent give me something

Intent Schema

Tex
{
  "intents": [
    {
      "intent": "GetNewFactIntent"
    },
    {
      "intent": "AMAZON.HelpIntent"
    },
    {
      "intent": "AMAZON.StopIntent"
    },
    {
      "intent": "AMAZON.CancelIntent"
    }
  ]
 }

Credits

T RUTH PUSHPA LATHA
3 projects • 2 followers

Comments