Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
/ sutr-io Public archive

Sutr is an IntelliJ plugin that can be used to generate the intent.json and utterances required to create Alexa Skills.

License

Notifications You must be signed in to change notification settings

slalombuild/sutr-io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Development setup

Intellij

  • Plugins required:
    • Grammar-Kit
    • Psi-viewer (recommended)
  • Update sutr-io.iml module type to 'PLUGIN_MODULE'
  • Add Library dependency on com.github.spullara.mustache.java:compiler:0.9.1
  • Update project structure
    • Mark src/resource as a Resource folder
    • Mark src as a Sources folder
    • Mark gen folder as Sources root
    • Modules -> Paths -> Use Module compile output path
    • Plugin deployment ->Path to META-INF/plugin.xml -> (project root directory)
  • Generate psi structure from bnf (both sutr and utr)
  • Generate .flex Lexer.

Sutr Overview

Installation: Open your Jetbrains IDE (IntelliJ, Webstorm, Pycharm, etc...) and go to Plugins -> Browse Repositories and search for 'Sutr'

The Sutr plugin can be used to generate the intent.json and utterances required to create Alexa Skills. It defines two files types: .sutr and .utr.

.sutr: Used to define sutrs using the language constructs below.
.utr: Used for Amazon style utterance phrases.
.json: Used for intent definition.

Sutr Actions

The Sutr plugin adds two actions to the IDE.
Both are available by right-clicking on the open .sutr file or one or more selected files in the project view.

Copy Intents: Creates the Intent.json structure from the selected file(s)
Copy Utterances: Creates a collection of utterances based on the selected file(s)

Sutr Language

type

A type is a Type Name with a comma separated list of values. This is used for creating/referencing Custom Types in the Alexa Skills Kit (ASK) syntax:

ex:

type LIST_OF_COLORS [
    grey,
    blue, 
    red,
    green,
    yellow
]

literals

Used for creating Amazon literal types. Declaration is the word literal followed by the name and a comma separated list of phrases.

ex:

literal MyAction [
    stand up,
    walk,
    run,
    jump,
    dance
]

Literals are used in Utterances to help build the voice model that is used to extract the literal content from your action.

sutrs

A Sutr is used to design intents and utterances for your Alexa app. Declaration is def followed by the Intent Name, slot parameters/types, and the list of utterances that could be used to trigger that intent and a function name to trigger within your application

In the example below, Number, MyAction, and LIST_OF_COLORS are slot types, while count, action and color are the names and used in the utterances.
The function name MyApplicationFunction will be used to generate the launcher code for your application and map the params/intent to that function.

ex:

def MyIntent(Number count, MyAction action, LIST_OF_COLORS color){
    I would like {count} {color} puppies to {action}
    Make {count} {color} puppies {action}
} => MyApplicationFunction

The combination of the type, literal, and sutr above would generate the following utterances:

MyIntent I would like {count} {color} puppies to {stand up|action}
MyIntent I would like {count} {color} puppies to {walk|action}
MyIntent I would like {count} {color} puppies to {run|action}
MyIntent I would like {count} {color} puppies to {jump|action}
MyIntent I would like {count} {color} puppies to {dance|action}
MyIntent Make {count} {color} puppies {stand up|action}
MyIntent Make {count} {color} puppies {walk|action}
MyIntent Make {count} {color} puppies {run|action}
MyIntent Make {count} {color} puppies {jump|action}
MyIntent Make {count} {color} puppies {dance|action}

and the following Intent.json:

{
    "intents": [
        {
            "intent": "MyIntent",
            "slots": [
                {
                    "name": "count",
                    "type": "AMAZON.NUMBER"
                },
                {
                    "name": "action",
                    "type": "AMAZON.LITERAL"
                },
                {
                    "name": "color",
                    "type": "LIST_OF_COLORS"
                }
            ]
        }
    ]
}

About

Sutr is an IntelliJ plugin that can be used to generate the intent.json and utterances required to create Alexa Skills.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published