microsoft / Recognizers-Text

Microsoft.Recognizers.Text provides recognition and resolution of numbers, units, date/time, etc. in multiple languages (ZH, EN, FR, ES, PT, DE, IT, TR, HI, NL. Partial support for JA, KO, AR, SV). Packages available at: https://www.nuget.org/profiles/Recognizers.Text, https://www.npmjs.com/~recognizers.text
MIT License
1.67k stars 429 forks source link

[* Number] Percentage recognizer resolution should resolve to fraction #196

Open johnataylor opened 6 years ago

johnataylor commented 6 years ago

Recognizing an utterance such as 'fifty percent' as a percentage value is great but it would be more helpful to client code if the resolution was to a floating point value.

Specifically: an utterance such as 'fifty percent' results in: "resolution": { "value": "50%" },

Given the type has been correctly identified as percentage it would be better for the client code to receive a floating point number.

This would also fit more naturally with NumberFormat where the client could use code like this:

        const formatter = new Intl.NumberFormat('en-US', { style: 'percent' });
        return formatter.format(obj.value);

Which would assume obj.value to be 0.5 for 50%

aitelint commented 3 years ago

@tellarin, should we address this one?

tellarin commented 3 years ago

This is lower priority for now. And the initial implementation would need a config flag (or resolution policy) to toggle between the old value representation and the new one.