Duckling behaves weirdly when amount-of-money and number is combines in one sentence

Has someone ever encountered this weird behaviour in Duckling?

When typing

price range between 10$ and 20

Duckling returns

[{'start': 20, 'end': 30, 'text': '10$ and 20', 'value': 10.2, 'confidence': 1.0, 'additional_info': {'value': 10.2, 'type': 'value', 'unit': '$'}, 'entity': 'amount-of-money', 'extractor': 'DucklingEntityExtractor'}]

So it somehow combines 10$ and 20 into 10.2

Even a weirder thing happens with the following case.

The following

price range between $15 and 243

becomes

[{'start': 20, 'end': 31, 'text': '$15 and 243', 'value': 17.43, 'confidence': 1.0, 'additional_info': {'value': 17.43, 'type': 'value', 'unit': '$'}, 'entity': 'amount-of-money', 'extractor': 'DucklingEntityExtractor'}]

Any ideas how to debug? I created a clear rasa project and this error gets reproduced.

Hi @llotus_eater, this is the behavior of duckling itself.

1. text = price range between 15$ and 243

{
        "body": "15$ and 243",
        "start": 20,
        "value": {
            "value": 17.43,
            "type": "value",
            "unit": "$"
        },
        "end": 31,
        "dim": "amount-of-money",
        "latent": false
}
2. text = price range between 15 and 243$

{
        "body": "between 15 and 243$",
        "start": 12,
        "value": {
            "to": {
                "value": 243,
                "unit": "$"
            },
            "from": {
                "value": 15,
                "unit": "$"
            },
            "type": "interval"
        },
        "end": 31,
        "dim": "amount-of-money",
        "latent": false
}

@rasa_learner That’s strange, right? That in one case, depending on the order, it extracts correctly, and in another one it does some weird math on the background? Any ideas what exactly is hapenning and how to fix this?

In case someone is getting a similar kind of error and is wondering how I fixed it.

The way I hacked it in the end is by creating a custom component and replacing “$” sign with “dollar” before entity prediction. Now Duckling extracts everything correctly.