0

I'd like to make Alexa to listen for special number - words like for example:

  • one two three,
  • one two,
  • five, six,
  • eight, nine, ten,
  • eleven

So I created this intent with the slot-type AMAZON.NUMBER:

img


  1. Can I make Alexa to just trigger this intent if the input words are on a specific list? ( Just trigger the intent if the input is "one two three" or "five six" and not if the input is e.g. "nine eleven")

  2. How can I capture the words on my node.js server like capturing "one two three" instead of the automatic result "123" = "onehundredtwentythree"?


skill.intent("numeric_input", function(request, response) {
  let inputID = request.slot("input").toLowerCase();
  response.shouldEndSession(false)
  console.log(inputID); // is "123"
})

Any help would be really appreciated.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470

3 Answers3

1

If you know how many numbers your input could have I would create utterances, such as: {input}, {input}{input}, {input}{input}{input}. Of course this will only work if you know, that number sequences are up to three numbers long.

To change numbers to words, you will have to use some sort of package or write it yourself to convert them, because alexa doesn't have any such functionality.

I have one more suggestion. If you know, that user can only say 1-9 numbers. That is not a lot and you can create custom slot with these values. In this case, alexa will return words to your code and you can block off certain numbers, that you don't want to get, f.e. eleven.Custom slot

R. Vait
  • 918
  • 2
  • 7
  • 20
1

As you did, you have to use AMAZON.Number slot type.

Can I make Alexa to just trigger this intent if the input words are on a specific list?

When you create a custom slot type, a key concept to understand is that this is training data for Alexa’s NLP (natural language processing). The values you provide are NOT a strict enum or array that limit what the user can say. This has two implications

1) words and phrases not in your slot values will be passed to you,

2) your code needs to perform any validation you require if what’s said is unknown.

It's always a good idea to validate the slot values at your backend. If the numbers are something which you don't support, respond back with a proper error message like

"Sorry I can proceed wiht Nine eleven, please give the correct number"

This way you will let your users know that they have to use a different number. If there is number input, any number can come in. So validate and guide.

How can I capture the words on my node.js server like capturing "one two three" instead of the automatic result "123" = "onehundredtwentythree"?

If you use AMAZON.Number slot type, the values will come as 123.

"numberSlot": {
    "name": "numberSlot",
    "value": "123",
    "confirmationStatus": "NONE"
}

You can easily validate 123 or convert it to any form as you need.

automatic result "123" = "onehundredtwentythree"?

I really didn't understand this. 123 is not automatically convereted to onehundredtwentythree. If you are pointing to the outspeech, or how Alexa speaks 123, then its a different case. Use <say-as interpret-as="digits">123</say-as> in you output SSML to spell each digit separately.

johndoe
  • 4,387
  • 2
  • 25
  • 40
  • I'd like to tell Alexa different numbers. Like **e.g** "one two eight" and I'd like not get as result "128" because if the input is "one eleven" the result would be "111" what could be interpreted as "one one one", "eleven one", "one eleven", "onehundredeleven" –  Sep 17 '18 at 16:29
  • In my case the numbers are long (IDs) like 596630, 485200 etc. How can I deal with it since it is impossible for user to say such a number like just `onehundredtwentythree`. – Subrata Sarkar Jun 20 '19 at 11:01
0

1.Create custom slot
2. Go to bulk edit of custom slot created and insert numbers in letters. You can get help from this link. Numbers in letters (Filter the numbers you don't want)
3.Create custom intent using the custom slot