facebook / duckling

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

AmountOfMoney/ES: Not recognice Currency after quantity #616

Closed clobotorre closed 3 years ago

clobotorre commented 3 years ago

When we talk about money, we usually say the quantity first and then the currency. For example, we say 'cinco euros'. In such a case Response is empty:

Request: curl -XPOST http://0.0.0.0:8000/parse --data 'locale=es_ES&text=cinco euros&dims=["amount-of-money"]'

Response:

[]

Using the form 'currency quantity' works, but that isn't the normal way, at least in Spanish: Request: curl -XPOST http://0.0.0.0:8000/parse --data 'locale=es_ES&text=euros cinco&dims=["amount-of-money"]'

Response:

[{"body":"euros cinco","start":0,"value":{"value":5,"type":"value","unit":"EUR"},"end":11,"dim":"amount-of-money","latent":false}]

chessai commented 3 years ago

I can't reproduce.

> debug (makeLocale ES Nothing) "cinco euros" [Seal AmountOfMoney]
<amount> <unit> (cinco euros)
-- number (0..15) (cinco)
-- -- regex (cinco)
-- currencies (euros)
-- -- regex (euros)
[
    {
        "body": "cinco euros",
        "dim": "amount-of-money",
        "end": 11,
        "latent": false,
        "start": 0,
        "value": {
            "type": "value",
            "unit": "EUR",
            "value": 5
        }
    }
]

How are you running duckling?

clobotorre commented 3 years ago

I'm running it this way:

stack exec duckling-example-exe

Is there any other way?

chessai commented 3 years ago

Also from my local server:

❯ curl -XPOST http://0.0.0.0:5406/parse --data 'locale=es_ES&text="cinco euros"' | jq
[
  {
    "body": "cinco euros",
    "start": 1,
    "value": {
      "value": 5,
      "type": "value",
      "unit": "EUR"
    },
    "end": 12,
    "dim": "amount-of-money",
    "latent": false
  }
]
clobotorre commented 3 years ago

Solved setting LANG environment variable before launching duckling. Thanks