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

[EN Number] Issue with fracLikeNumberParse in JavaScript #2716

Open hershkoy opened 3 years ago

hershkoy commented 3 years ago

Describe the bug In English Number, I tried to parse the sentence: "two out of five hundred tvs". The result I expected was 2/500=0.004. But see below, it doesn't work.

To Reproduce Steps to reproduce the behavior: Add this case to

  {
    "Input": "two out of five hundred tvs",
    "Results": [
      {
        "Text": "two out of five hundred",
        "TypeName": "number",
        "Resolution": {
          "subtype": "fraction",
          "value": "0.004"
        },
        "Start": 0,
        "End": 22
      }
    ]
  },  

Run:

>ava --match='*tvs*'

Result is:

  index-number » Number - English - NumberModel - "two out of five hundred tvs"

  Result.Resolution.value

  Difference:

  - 'INFINITY'
  + '0.004'

Expected behavior It should pass the test

tellarin commented 2 years ago

"two out of five hundred tvs" work in .NET. But weirdly "two out of five hundreds tvs" produces wrong results. @aitelint Can you take a quick look? At least the incorrect sentence shouldn't produce such incorrect results in .NET.