Example configurations

See some examples of SAL configurations. Use them as the scaffold for your application, or learn how to improve your own configuration.

The SAL Syntax Reference should come in handy as well.

Home Automation

A simple home automation application for turning devices located in different rooms on and off.

  • Intents: turn_on, turn_off
  • Entities: device, location

Example utterances

  • turn on the lights in the kitchen
  • turn off the lights in the bedroom and in the living room
  • turn everything off

Try in Playground »

Configuration

rooms = [kitchen|bedroom|living room|closet|pantry|hallway|everywhere|all rooms|every room](location)
room = [{in} {the} $rooms]
list_of_rooms = [$room {{and} $room {{and} $room}}]
devices = [lights|television|radio|everything|all devices|every device](device)
device = [{the} {$rooms} $devices]
list_of_devices = [$device {and $device {and $device}}]
command = [turn|set|switch|put]
intent = [
    *turn_on {$command} $list_of_devices on {$list_of_rooms}
    *turn_on $command on $list_of_devices {$list_of_rooms}
    *turn_off {$command} $list_of_devices off {$list_of_rooms}
    *turn_off $command off $list_of_devices {$list_of_rooms}
]
$intent {and $intent}

Coffee Ordering

A simple customer service application for placing orders for different types of coffee.

  • Intents: order
  • Entities: size, type, addition, shot

Example utterances

  • can I have a double espresso please
  • large cappuccino
  • make me a large cappuccino and a regular coffee

Try in Playground »

Configuration

ask = [i'd like to have | make me | order | i want | can I have | may I have] {[a | an]}
size = [small | medium | large](size)
shot = [single | double | triple](shot)
coffee = [coffee|regular coffee|americano|cappuccino|espresso|latte|cafe latte](coffee)
addition = [milk | cream | sugar | syrup](addition)
order = *order {$ask} {$size} {$shot} $coffee {with $addition {and $addition}} {please}
$order {{and} $order}

Calculator

A simple voice calculator that supports basic arithmetic operations (+, -, x, /, and raising to a power).

  • Intents: calculate, append
  • Entities: number, operation

Example utterances

  • 36 plus 5
  • 4 times 20 plus 5
  • 77 plus 9 plus 4

Try in Playground »

Configuration

number = $SPEECHLY.CARDINAL_NUMBER(number)
operation = [plus|minus|times|divided by|to the power of](operation)
calculate = *calculate $number $operation $number
append = *append $operation $number
$calculate {$append {$append {$append}}}
$append

Profile image for Antti Ukkonen

Last updated by Antti Ukkonen on April 12, 2021 at 17:16 +0300

Found an error on our documentation? Please file an issue or make a pull request