npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

alexa-vui-generator

v2.1.0

Published

Generates the language model file describing the intents and types of an Alexa Skill

Downloads

11

Readme

Generator for Alexa Voice Interface definitions

npm version Build Status

Installation

npm install alexa-vui-generator

Usage

const generator = require('alexa-vui-generator');

generator.createLanguageModel(options, locale);

options is an object which configures the generation of the language model

  • processors is an array of functions that manipulate the provided VUI model.
  • invocation is a string that denotes the invocation name of the skill
  • pretty defines if the output should be pretty printed. By default it is minified.
  • skipOutput can be set to true to skip writing the output file

locale is the locale that is generated and denotes the file name. (models/{locale}.json). It is forwarded to the processor functions as the second argument.

outputDir is the folder to write the VUI (defaults to './models')

Using intents.yaml

You can use the provided function readIntentsFromYAML as a function in processors that reads the intents from a file called intents.yaml and adds the Amazon default intents.

Furthermore it expands the provided texts to allow variations in the language. See example for usage.

intents.yaml

MySuperIntent:
  texts:
    - (Play|Start|Open) the {channel} (channel|)
  slots:
    channel: ChannelName

This resolves to the following intent definition:

{
  "name": "MySuperIntent",
  "samples": [
    "play the {channel} channel",
    "start the {channel} channel",
    "open the {channel} channel",
    "play the {channel}",
    "start the {channel}",
    "open the {channel}"
  ],
  "slots": [
    {
      "name": "channel",
      "type": "ChannelName",
      "samples": []
    }
  ]
}

To support different locales you can provide an object as texts with the locales as keys instead of a string array.

intents.yaml

MySuperIntent:
  texts:
    'en-US':
      - (Play|Start|Open) the {channel} (channel|)
    'de-DE':
      - (Spiele|Starte|Öffne) den {channel} (channel|Kanal|)
  slots:
    channel: ChannelName

To use dialog support you can specify the slot in an expanded way:

intents.yaml

CalculateIntent:
  texts:
    - ja (bitte|)
    - ausrechnen
  slots:
    age:
      type: AMAZON.NUMBER
      elicitationRequired: true
      confirmationRequired: false
      prompt: Wie alt bist du?
      texts:
        - Ich bin {age} (Jahre alt|)
        - '{age}'

Using types.yaml

You can use the provided function readTypesFromYAML as a function in processors that reads the slot types from a file called types.yaml.

types.yaml

ChannelName:
  rock:
    - rock
    - rock music

This resolves to the following intent definition:

{
  "name": "ChannelName",
  "values": [
    {
      "id": "rock",
      "name": {
        "value": "rock",
        "synonyms": [
          "rock",
          "rock music"
        ]
      }
    }
  ]
}

To support different locales you can provide an object as values with the locales as keys instead of a string array.

types.yaml

ChannelName:
  rock:
    'en-US':
      - rock
      - rock music
    'de-DE':
      - rock
      - rock musik

Other generator functions used as processors

createAudioPlayerIntents - Creates the intents needed when using the AudioPlayer functionality. createDisplayIntents - Creates the intents needed when using the Display functionality.