0.1.20 • Published 5 years ago

alexa-language-model-generator v0.1.20

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Overview

Use a simple syntax to quickly define the interaction model of your alexa skill.

For example

(recipe|receipes) for (|a|an) {item}

will expand to:

recipe for {item}
receipes for {item}
recipe for a {item}
receipes for a {item}
recipe for an {item}
receipes for an {item}

Where {item} refers to a custom slot containing several entities. For instance:

item:
  'en-US':
    - snow golem:
    - pillar quartz block
    - firework rocket
  'en-GB':
    - snow golem
    - pillar quartz block
    - firework rocket
  'de-DE':
    - Schneegolem
    - Quarzsäule
    - Feuerwerksrakete

Intent File

Your intent file includes all the intents and the sample utterances like the following:

RecipeIntent:
  'en-US':
    - how (can|do) (I|you) (build|craft|get|make) (|a|an) {item}
    - how is (|a|an) {item} (built|crafted|made)
    - (recipe|receipes) for (|a|an) {item}

In this case only locale en-US is defined.

Dialogs

Adding dialog features requires the following syntax:

  • End any of the sample utterance where you would like to have slot elicitation or delegation with a colon :
  • Add the slot name
  • Add keys
    • prompts for all prompts that are coming from Alexa to ask the customer
    • samples for all samples the customer might say
    • confirm if you want to confirm the slot and the sample for that

You can also specify auto delegation behavior and confirmation per intent.

For instance:

NavigateIntent:
  +autodelegate: true
  +confirm:
    - sure (|that you want to proceed)?
    - please confirm
  'en-US':
    - (Navigate|directions|drive me|take me) to ({cityus} {yesnostreet}|{street} {cityus}|{street}):
      street:
        prompts:
          - Which street?
        samples:
          - (|to) {street}
        confirm:
          - I heared {cityus}. Is that correct?
    - get me to {street}

Types File

Provide the name of the slot as described in the intent file and list all entries or built-in slot values.

cityus: AMAZON.US_CITY

Synonyms

item:
  'en-US':
    - snow golem:
      - ice golem
      - spice golem
      - rice golem
    - pillar quartz block
    - firework rocket

defines snow golem with the three synonyms

ice golem
spice golem
rice golem

id of the synonym is set to constant case of the value name. So in the above case it is SNOW_GOLEM.

It is also possible to define your own id by changing the above definition to

item:
  'en-US':
    - snow golem:
      id: GOLEM
      synonyms:
        - ice golem
        - spice golem
        - rice golem
    - pillar quartz block
    - firework rocket

Now the id is explicitly set to GOLEM.

Slot ID's

Slot id is generated as constant case using change case.

Usage as CLI

npx alexa-language-model-generator -i invocation.yml -l "en-US" -n intents.yml -t types.yml -m models

You can also install the tool globally and invoke it without npx: npm i -g alexa-language-model-generator

Options

Invocation File Path

-i, --invocation [path]

Invocation name file path (default models/invocation.yml)

Locale

-l, --locales [locales] Specific Locales separated by comma (default all)

currently all equals: de-DE,en-AU,en-CA,en-GB,en-IN,en-US,es-ES,es-MX,fr-FR,ja-JP

Intent File Path

-n, --intents [path]

Intent file path where all intents are defined (default models/intents.yml)

Types File Path

-t, --types [path] Intent file path where all types are defined (default models/types.yml),

Models Path

-m, --models [path] Path to the folder where model JSON files should be stored (default models)

0.1.20

5 years ago

0.1.19

5 years ago

0.1.18

5 years ago

0.1.17

5 years ago

0.1.16

5 years ago

0.1.15

5 years ago

0.1.14

5 years ago

0.1.13

5 years ago

0.1.12

5 years ago

0.1.11

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.0.1

6 years ago