Rasa number text identification and conversion to numerical number

Hello everyone.

I have the following intent:

- intent: inquire_invoice_history
  examples: |
    - please show my invoice of last [one](month) month
    - please show my invoice of last [two](month) months
    - what is my invoice of last [three](month) months?
    - what is my invoice of last [five](month) months?
    - invoice last [three](month) months
    - i want my invoice of last [one](month) months

I am using DucklingEntityExtractor:

 - name: DucklingEntityExtractor
    url: http://localhost:8000
    dimension:
      - email
      - number

And I defined my month slot as follows:

slots:
 month:
    type: text
    influence_conversation: false
    mappings:
      - type: from_entity
        entity: number

But when I try to access the the slot in my custom action, I get a None. I tried getting the month slot as:

month_number = next(tracker.get_latest_entity_values("month"), None)

and tried the following as well:

month_number = tracker.get_slot("month")

My goal is to achieve the text “one”/“two” as 1/2. How should I acheive this and what am I doing wrong?

Thank you in advance.

  1. You don’t have to annotate data for entity extraction with duckling. The following is sufficient,
- intent: inquire_invoice_history
  examples: |
    - please show my invoice of last one month
    - please show my invoice of last two months
    ...
  1. Have you added “number” and “email” under entities in the domain file?
entities:
    ...
    - number
    - email

Hello there. Thank you for your reply. Yes, I have added “number” and “email” under entities in the domain file.

Are you also running the duckling server with docker?

Yes, I am. My email validation and another action is working fine. The number thingy is what I am stuck with.

You can use rasa interactive to check if the entity is being extracted

Ahhhh. Had a interesting find using interactive.

Is the intent 'inquire_bill_history' correct for 'i want my electricity bill of [last one month]{"entity": "time", "value": {"to": "2022-09-01T00:00:0 0.000-07:00", "from": "2022-08-01T00:00:00.000-07:00"}}' and are all entities labeled correctly?

How can we move forward with this and expect my output?

“last one month” is being extracted as a time entity.

In custom actions, you can convert this to the format you prefer.

1 Like

Thank you so much! I have been sitting on this for the last few hours. May you find everything you’re looking for! :pray:

Thank you and wish you the best of luck as well :slight_smile:

1 Like