Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Regex with Rasa

I'm trying to use Rasa to detect entities such as phone numbers or contract ID. It seems natural to use regular expressions to define precisely those entities, and Rasa does have something called "Regular Expression Features" which allows us to define regular expressions.

Except I don't understand how to use them. In the Rasa-NLU tutorial, there are regexes (like "zipcode"), but I don't see how they are linked to entities ("location").

Does anyone have a clue about how regexes work with Rasa ?

like image 972
Daneel Avatar asked Mar 30 '18 13:03

Daneel


People also ask

How do I extract entities in Rasa?

Entities are structured pieces of information inside a user message. For entity extraction to work, you need to either specify training data to train an ML model or you need to define regular expressions to extract entities using the RegexEntityExtractor based on a character pattern.

What is NLU in Rasa?

Rasa is a tool to build custom AI chatbots using Python and natural language understanding (NLU). Rasa provides a framework for developing AI chatbots that uses natural language understanding (NLU).

What is look up table in Rasa?

Lookup Tables in RASA 3. x. The lookup table can be defined as a list of words used to generate a particular pattern; it is written in the nlu. yml file.

What does Rasa train do?

rasa train will store the trained model in the directory defined by --out , models/ by default. The name of the model by default is <timestamp>. tar.


1 Answers

The regexes you define are not linked to any entity or intent explicitly. What a regex does is add a new feature to your input, e.g. an extra vector element which can be 1 or 0 depending on whether the regex matched. When you train, the model now has this extra information about each of your examples, and can choose itself when to pay attention to it.

like image 197
amn41 Avatar answered Sep 22 '22 13:09

amn41