How do synonyms work? Classifier? Exact pattern matching?

I was strugging to find how synonyms work in Rasa. I had assumed that there was a classifier that was trained on the synonyms examples to map to any of the defined synonyms or just use the identity mapping if the phrase is classifed as in the “other” category (using the entities that synonyms weren’t provided for as signal).

I decided to take a look at the code (please let me know if there are docs on this): https://github.com/RasaHQ/rasa/blob/main/rasa/nlu/extractors/entity_synonyms.py#L145. It looks like it’s just doing case-insensitive exact matching. Is it the case that user’s input has to exactly match a given spelling/phrasing of the synonym for it to get mapped to the synonym?

1 Like

Haven’t checked the code previously, but from experience, I can confirm that it is doing a case-insensitive exact matching.

1 Like

Is there some sort of experimental feature that replaces this exact matching with a classifier? Seems like this would be a common thing people put in custom actions.

1 Like

Not that I know of, but it would be great to see improvements in this area

Wait, can’t we just use roles to get a more flexible mapping (mimics a classifier that maps from entity values to specific classes, where the roles are like the classes)?