EntityRecognizer.parseNumber doesn't work with decimals
When Luis.ai detects a decimal number such as 43.4, it successfully parses it as a builtin.number entity. However, Luis adds a space before and after the decimal point like this 43 . 4. EntityRecognizer.parseNumber only parses and returns 43 because of the extra spaces. Either this can be fixed on Luis.ai or by modifying the regex parseNumber relies on.
Tested on botbuilder v 3.2.3
In the response from LUIS, each entity mention includes pointers into the original (pre-tokenized) query string indicating the start and end characters of the entity substring. Could that be used in parseNumber?
For example:
{ "query": "hello 4.3 thanks", "intents": [ { "intent": "None", "score": 0.8677383 } ], "entities": [ { "entity": "4 . 3", "type": "builtin.number", "startIndex": 6, "endIndex": 8, "score": 0.839945734 } ] }
The string “4.3” (without spaces) can be recovered with this pseudocode:
startIdx = result[‘entities’][0][‘startIndex’] endIdx = result[‘entities’][0][‘endIndex’] entityString = result[‘query’][ startIdx:endIdx ]
That is a good work around that I didn't think of. I chose to just modify how ParseNumber works by relaxing the regex a little #1033.
Closing this as it seems you have a work around and a PR going on. Thanks!
jason, who replied above, is part of the luis team, and they have captured this issue in their backlog. Thank you!