justin avatar image
justin posted

Handling Compound Numbers

When handling compound numbers that require more than one potential input (seven hundred fifty six thousand), we recommend you split the thousands, millions, etc. into different number slots. You can then handle the concatenation within your code after the intents are fulfilled.

An example: Intent Schema

    "intents" : [ {
      "intent" : "GetNumber",
      "slots" : [{
          "name" : "numberOneToNineHundredNinetyNine",
          "type" : "AMAZON.NUMBER"
      }, {
          "name" : "numberThousands",
          "type" : "AMAZON.NUMBER"
      }, {
          "name" : "numberMillions",
          "type" : "AMAZON.NUMBER"

Sample Utterances

GetNumber {numberOneToNineHundredNinetyNine}
GetNumber {numberThousands} thousand
GetNumber {numberThousands} thousand {numberOneToNineHundredNinetyNine}
GetNumber {numberMillions} million
GetNumber {numberMillions} million {numberThousands} thousand {numberOneToNineHundredNinetyNine}
GetNumber {numberMillions} million {numberOneToNineHundredNinetyNine}

From there, you will want to multiply any value in the GetNumber intent handler by their interpreted value (numberMillions * 1000000, numberThousands * 1000).

You can then add this to the numberOneToNineNineNine value to achieve your desired value.

Keywords: thousands, millions, compound numbers, large numbers

alexa skills kit
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.



kiruluta contributed to this article Justin@Amazon contributed to this article