How can we extract different entities of the same type with different entity names?

Hello everyone

We are currently testing if Rasa can help us extract some information from user input. In our case, we have this sample of a message said by a user:

My last payment was processed on January 9th 2020 and the amount is $699.26. My next payment is due March 1st, 2020 and the amount is $321.45.

Then, we want to extract the dates and money values in different entity names like:

  • last_payment_date
  • last_payment_amount
  • next_payment_date
  • next_payment_amount

The extraction is working fine, but the money values are always matched to the first entity (last_payment_amount), instead of putting the first one with last_payment_amount and the last one to next_payment_amount. The dates are matched to the correct entity.

Then, are we missing something? Is this possible with Rasa?

Thanks,

Hi @DanielOlarte, I would suggest using duckling to extract dates and times. And then use a custom action in Core to set the slots. For this type of distinction you’ll probably need to do some checking as to whether the words “next” or “last” are present in the sentence when deciding which slot to set

@akelad Thanks for the reply. Yes, we currently use duckling for that and it’s working perfectly. Is there a place in the documentation where I can see how can I check for existence of a word in a sentence to decide which slot to set? Thanks!

@DanielOlarte you can just do this in a custom action with the usual python methods. This is nothing specific to Rasa

Ok, awesome. We will try it and I’ll let you know if I find another issue.