-2

I used builtin.number in my LUIS app trying to collect a 4 digit pin number. The following is what's returned from LUIS when my input is "one two three four".

"entities": [ { "entity": "one", "type": "builtin.number", "startIndex": 0, "endIndex": 2, "resolution": { "value": "1" } }, { "entity": "two", "type": "builtin.number", "startIndex": 4, "endIndex": 6, "resolution": { "value": "2" } }, { "entity": "three", "type": "builtin.number", "startIndex": 8, "endIndex": 12, "resolution": { "value": "3" } }, { "entity": "four", "type": "builtin.number", "startIndex": 14, "endIndex": 17, "resolution": { "value": "4" } },

As you can see, it's returning individual digits in both text and digit format. Seems to me that it's more important to return the whole digit than the individual ones. Is there a way to do it so that I get '1234' as result for builtin.number?

Thanks!

1 Answers1

0

It's not possible to do what you're asking for by only using LUIS. The way LUIS does its tokenization is that it recognizes each word/number individually due to the whitespace. It goes without saying that 'onetwothreefour' will also not return 1234.

Additionally, users are unable to modify the recognition of the prebuilt entities on an individual model level. The recognizers for certain languages are open-source, and contributions from the community are welcome.

All of that said, a way you could achieve what you're asking for is by concatenating the numbers. A JavaScript example might be something like the following:

var pin = '';
entities.forEach(entity => {
  if (entity.type == 'builtin.number') {
    pin += entity.resolution.value;
  }
}

console.log(pin); // '1234'

After that you would need to perform your own handling/regexp, but I'll leave that to you. (after all, what if someone provides "seven eight nine ten"? Or "twenty seventeen"?)

Steven G.
  • 1,632
  • 1
  • 11
  • 14