Skip to content
Advertisement

Add new pattern in Entity Ruler Spacy with regex in multiple tokens

I have this code that works well if I try to search exact words.

JavaScript

But the regex doesnt work for whole sentence but just for each token.

I tried to add something like this to add new entity but it doesnt still show the new label DIN in the output.

JavaScript

What all am I doing wrong? How can I add to the nlp model new rule based on regex that searches in the whole input? THANKS!!

Advertisement

Answer

Since your regexes are just for numeric tokens, just add a new token to your pattern.

JavaScript

How can I add to the nlp model new rule based on regex that searches in the whole input?

The Matcher just doesn’t support that. If you want to use regexes against the whole input you can do that yourself and add the spans directly, you don’t need the Matcher.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement