Issues trying to implement EntitySynonymMapper with lookup tables

I am currently trying to implement EntitySynonymMapper with Lookup tables. What I have setup so far in my training data is the lookup table for the entity category and entity_synonyms as mentioned here Training Data Format

I also added EntitySynonymMapper to my Config file.

The issue is, that my Entities still only get properly recognized if I use the exact spelling from the lookup tables. If I mention alternative spellings that are mentioned in my entity_synoyms it does not get picked up.

Anything I am missing?

Example: I have in my category lookup table a category named Infrastructure and I created a synonym in my training data like so:

synonym:Infrastructure

  • passive infrastructure
  • Infra
  • infrastructure
  • INFRASTRUCTURE

training data for the intent Inform looks like so:

My config: config.yml (513 Bytes)

Now If I type the exact phrase Can you get me the category Infrastructure, It works correctly, but if I type: Can you get me the category Infra, it does not detectet Infra as the entity Infrastructure.

Any help is appreciated, if there is a better method of going about this entirely, Im also open.

End goal is to simply ask the user to provide a category and then using that category for a database query.

Thanks!

You need to add the synonyms to the lookup table.That’s because the pipeline in rasa, it first detect that a gram is an entity and then the synonym mapper changes it.

@Gehova Thanks for your suggestions, but this simply leads to the category being filled with the synonym value, but it doesnt get changed. So now if I type Get me the category “Infra” it detects it correctly but just fills the slot with “Infra” instead of replacing it with “Infrastructure”. Do I need to somehow include this in my stories or something?

For your information I am using Rasa X to talk to the bot and adapt things, so maybe this is also causing the issue?

Your pipeline is incorrect. The CRFEntityExtractor must be placed before the EntitySynonymMapper. Check the documentation about pipelines:

1 Like

@Gehova Thanks so much… I spend way to much time trying to figure out what I was doing wrong. This fixed it.