facebook / duckling

Language, engine, and tooling for expressing, testing, and evaluating composable language rules on input strings.
Other
4.05k stars 720 forks source link

Incorrect parsing of date range in French [FR] #650

Open belamenso opened 3 years ago

belamenso commented 3 years ago

Offending phrase: du 1er juillet 2021 au 30 juin 2022 (from July 1, 2021 to June 30, 2022) Command:

curl -XPOST http://0.0.0.0:8000/parse --data 'locale=fr_CH&text="du 1er juillet 2021 au 30 juin 2022"'

Current output:

[
   {
      "body":"du 1er juillet 2021 au 30 juin 2022",
      "start":1,
      "value":{
         "values":[
            {
               "to":{
                  "value":"2022-07-01T00:00:00.000-07:00",
                  "grain":"day"
               },
               "from":{
                  "value":"2021-07-01T00:00:00.000-07:00",
                  "grain":"day"
               },
               "type":"interval"
            }
         ],
         "to":{
            "value":"2022-07-01T00:00:00.000-07:00",
            "grain":"day"
         },
         "from":{
            "value":"2021-07-01T00:00:00.000-07:00",
            "grain":"day"
         },
         "type":"interval"
      },
      "end":36,
      "dim":"time",
      "latent":false
   },
   {
      "body":"2022\"",
      "start":32,
      "value":{
         "second":2022,
         "value":2022,
         "type":"value",
         "unit":"second",
         "normalized":{
            "value":2022,
            "unit":"second"
         }
      },
      "end":37,
      "dim":"duration",
      "latent":false
   }
]
chessai commented 3 years ago

It looks like the only issue is that there's two interpretations returned by duckling. Note that the first one is correct because duckling time intervals are upper-exclusive based on the grain.

belamenso commented 3 years ago

You're correct. I was unaware of the upper-exclusive interval. Thank you for your time.

chessai commented 3 years ago

No problem. Re-opening because duckling shouldn't return two results here.