Regex based entity extraction in rasa

I want to update my entities with regex. Entity Extraction says it can be done post-NLU. Would it be possible to get an example as to where in rasa’s code to insert the reflex matching?

Hey @sidkgp

I believe that you’re looking for slot validation in action.py file.

You can check the usage example here, method validate_cuisine().

I am actually not looking to fix the false positives (for which your solution is great), but want to catch false negatives (or improve recall) through regexes. For example, I want to say all [0-9]{5} is zipcode and catch stuff that is missed by rasa’s default entity recognizers.

Hey @sidkgp you can do some regex matching from within a custom action, by getting the tracker.latest_message and doing e.g. re.search() on that. Then you can store whatever you find there in a slot

But the example you mention (and any other entities like numbers, time, amount of money etc) can be handled by the duckling entity extractor