Extract multiple occurrence of an entity in a single statement

I am trying to extract multiple occurrences of an entity in a single statement. E.g. User: I want to find the tickets for id AB443, FB232 and CD090. Bot: Sure, here are the informations about tickets:

  1. ABC443: Shipped
  2. FB232: In Process
  3. CD090: Delivered

To achieve this, I have defined an regex entity here, which can identify the tickets as they are alpha-numerical characters. I have also defined a slot for the same with type list. But that didn’t work.

Can someone help me how to achieve this?

Thanks.

1 Like

@souvikg10, @Juste, @erohmensing, @akelad

Hello everybody!

i have the challenge too, I try to extract multiple entity values (of the same entity) from a message. I explain more, we suppose i have an entity named cuisine, and this is the user message “where can i found a german and chineese food?”

in nlu i have :

-where can i find [german](cuisine) food?
-where can i find [chineese](cuisine) food?

how can in put “german” and “chineese” in a slot_list?

my config: win7 py3.7.2 rasa1.1.4

thank you

@dkbhadeshiya what does your training data look like? And can you see whether the entities get extracted correctly in debug mode?

@OUHIBIadel you would need to provide examples of sentences where both entities occur at the same time

@akelad

thank you very much,

I solved my issue like this:

prediction = tracker.latest_message
length = len(prediction['entities'])        
for i in range(length):
      entity_value = prediction['entities'][i]['value']
      dispatcher.utter_message("entity_value_{} : {}".format(i+1,entity_value)) 

I played with length and entity_value in my cutom action,

Just one last thing, how rasa choose when two entity values were found in the user message.

In my case, i saw that sometimes the core respond with the entity value having the lower confidence :confused:

Thank you

@OUHIBIadel there is the get_latest_entity_values function which will get all entities recognised for you and you can decide which one you want to set the slot with

Hi, Thank you very much @akelad, I solved my issue, it isn’t very accurate, but its ok.

Now, i like to save conversations in a sqlite database,

this is what i put in endpoints:

tracker_store:
    type: SQL
    dialect: "sqlite"  # the dialect used to interact with the db
    url: # (optional) host of the sql db, e.g. "localhost"
    db: "rasa.db"  # path to your db
    username:  # username used for authentication
    password:  # password used for authentication
    # query: # optional dictionary to be added as a query string to the connection URL
      # driver: my-driver

and this is my agent, in run_app file:

Interpreter = RasaNLUInterpreter("./models")
MODEL_PATH = "./models"
ActionEndpoint = EndpointConfig(url="http://localhost:5055/webhook")
db = SQLTrackerStore(domain="domain.yml", db="./rasa", event_broker=None)

agent = Agent.load(MODEL_PATH, interpreter=Interpreter,
                   action_endpoint=ActionEndpoint,tracker_store=db)

i cant find conversations in rasa.db file :frowning:

Could you help me please, knowing that i use only rasa (without rasax)

Thank you and have a good day

Hi, I created a new issue here to Save conversation sqlite

you can close this

thanks