Number prebuilt entity for a LUIS app

There are many ways in which numeric values are used to quantify, express, and describe pieces of information. This article covers only some of the possible examples. LUIS interprets the variations in user utterances and returns consistent numeric values. Because this entity is already trained, you do not need to add example utterances containing number to the application intents.

Types of number

Number is managed from the Recognizers-text GitHub repository

Examples of number resolution

Utterance Entity Resolution
one thousand times "one thousand" "1000"
1,000 people "1,000" "1000"
1/2 cup "1 / 2" "0.5"
one half the amount "one half" "0.5"
one hundred fifty orders "one hundred fifty" "150"
one hundred and fifty books "one hundred and fifty" "150"
a grade of one point five "one point five" "1.5"
buy two dozen eggs "two dozen" "24"

LUIS includes the recognized value of a builtin.number entity in the resolution field of the JSON response it returns.

Resolution for prebuilt number

API version 2.x

The following example shows a JSON response from LUIS, that includes the resolution of the value 24, for the utterance "two dozen".

{
  "query": "order two dozen eggs",
  "topScoringIntent": {
    "intent": "OrderFood",
    "score": 0.105443209
  },
  "intents": [
    {
      "intent": "None",
      "score": 0.105443209
    },
    {
      "intent": "OrderFood",
      "score": 0.9468431361
    },
    {
      "intent": "Help",
      "score": 0.000399122015
    },
  ],
  "entities": [
    {
      "entity": "two dozen",
      "type": "builtin.number",
      "startIndex": 6,
      "endIndex": 14,
      "resolution": {
        "subtype": "integer",
        "value": "24"
      }
    }
  ]
}

Preview API version 3.x

The following JSON is with the verbose parameter set to false:

{
    "query": "order two dozen eggs",
    "prediction": {
        "normalizedQuery": "order two dozen eggs",
        "topIntent": "None",
        "intents": {
            "None": {
                "score": 0.7124502
            }
        },
        "entities": {
            "number": [
                24
            ]
        }
    }
}

The following JSON is with the verbose parameter set to true:

{
    "query": "order two dozen eggs",
    "prediction": {
        "normalizedQuery": "order two dozen eggs",
        "topIntent": "None",
        "intents": {
            "None": {
                "score": 0.7124502
            }
        },
        "entities": {
            "number": [
                24
            ],
            "$instance": {
                "number": [
                    {
                        "type": "builtin.number",
                        "text": "two dozen",
                        "startIndex": 6,
                        "length": 9,
                        "modelTypeId": 2,
                        "modelType": "Prebuilt Entity Extractor"
                    }
                ]
            }
        }
    }
}

Next steps

Learn about the currency, ordinal, and percentage.