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

Date range not recognized at all, mistakenly recognized phone number and seconds #653

Open belamenso opened 3 years ago

belamenso commented 3 years ago

Offending input: 01.07.2021 - 30.06.2026 Command

curl -XPOST http://0.0.0.0:8000/parse --data 'locale=fr_CH&text="01.07.2021 - 30.06.2026"'

Current erroneous output:

[
    {
        "body": "01.07.2021 - 30.06.2026",
        "dim": "phone-number",
        "end": 24,
        "latent": false,
        "start": 1,
        "value": {
            "type": "value",
            "value": "0107202130062026"
        }
    },
    {
        "body": "2026\"",
        "dim": "duration",
        "end": 25,
        "latent": false,
        "start": 20,
        "value": {
            "normalized": {
                "unit": "second",
                "value": 2026
            },
            "second": 2026,
            "type": "value",
            "unit": "second",
            "value": 2026
        }
    }
]
chessai commented 2 years ago

What happens if you constrain the output to just the time dimension? See README for how to do that.

belamenso commented 2 years ago

It only recognized years in that case, and not even a year range. Still pretty unsatisfactory.

Command:

curl -XPOST http://0.0.0.0:8000/parse --data 'locale=fr_CH&text="01.07.2021 - 30.06.2026"&dims="["time"]"'

Output:

[
    {
        "body": "2021",
        "dim": "time",
        "end": 11,
        "latent": false,
        "start": 7,
        "value": {
            "grain": "year",
            "type": "value",
            "value": "2021-01-01T00:00:00.000-08:00",
            "values": [
                {
                    "grain": "year",
                    "type": "value",
                    "value": "2021-01-01T00:00:00.000-08:00"
                }
            ]
        }
    },
    {
        "body": "2026",
        "dim": "time",
        "end": 24,
        "latent": false,
        "start": 20,
        "value": {
            "grain": "year",
            "type": "value",
            "value": "2026-01-01T00:00:00.000-08:00",
            "values": [
                {
                    "grain": "year",
                    "type": "value",
                    "value": "2026-01-01T00:00:00.000-08:00"
                }
            ]
        }
    }
]
Benjaminrivard commented 11 months ago

Hello,

We are stumbling on the same issue.

I don't have much experience in Haskell developpement, how can I help to reach a resolution ?

Best, Benjamin