Detect entities without a space

Hello,

I would like to detect $100 or 100USD or 50EUR as two entities currency and amount, but if I put the following in NLU

[35.50](t_amount)[USD](currency)

I got a warning “Misaligned entity annotation in message”

Please note this is for English, of course

Thanks!

1 Like

why not use regex extractor or duckling for extracting amount and currency?

since you have a Whitespace tokenizer, it splits entity annotation by whitespace and thus the error

1 Like

Hello,

I tried the following:

  1. I have enabled duckling
  2. changed NLU like this:
- transfer [35.50](t_amount)[USD](currency) from my [savings](from_account) account to my [loan](to_account) account

duckling is detecting the amout of money like this:

transfer [35.50USD]{"entity": "amount-of-money", "value": 35.5} from my [savings](from_account) account to my [loan](to_account) account

but there are 2 problems:

  1. currency is missing
  2. entity name is not matching

Any idea how can amount as amount and currency as currency?

Thank you very much for your time

Well you don’t need to tag t_amount and currency in your training if you are using duckling. Duckling is independent of that. you would have to use the name duckling returns, not your own. if you need to use your own entity name then map it in custom action

Also If you look at the logs of NLU, duckling does provide additional info where currency is provided but you would need a custom action to make the slot mapping work. since Rasa by default maps value of duckling returned entity to the slot of the same name, everything other options needs to be configured in a custom action