How to mix Regex Expressions and Regular Strings to SpanRuler? #13099
-
For SpanRuler, How do I add terms AND regular expressions to my terms list? For the below code, everything works but the regex term: when I add the regex pattern to the terms list, I get:
Myself, I'm mixing extracted terms (from the corpus) and (many) patterns I'm also looking for.... Many thanks in advance
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @grahamanderson, enclose the pattern for your regex in terms = [
{'ent': 'ACRO', 'patterns': ['AA']},
{'ent': 'DEF', 'patterns': ['Airplane Agoraphobia']},
{'ent': 'ACRO_UNKNOWN', "patterns": [[{"TEXT": {"REGEX":"[A-Z][A-Z-0-9]+"}}]]} #T1, THING2
#[{"label": "FRT", "pattern": [{'TEXT' : {'REGEX': "[Aa]ppl[e|es]"}}]},
] |
Beta Was this translation helpful? Give feedback.
Hi @grahamanderson,
enclose the pattern for your regex in
[]
, as a list of patterns is expected (see the docs):