span_ruler is not working on ENT patterns #12978
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Using token patterns, each
To match one or more tokens, you can use:
Docs on operators: https://spacy.io/usage/rule-based-matching#quantifiers If you might ever have two adjacent entity spans (e.g. something like "following a week of [intense headaches] [chest pain] for three days") and you only want to match one of the spans, you'd need to also include the
Alternatively, you could merge all entities into a single token before running patterns if you only need the phrase (and not the tokenization) in your results: https://spacy.io/api/pipeline-functions#merge_entities. Then |
Beta Was this translation helpful? Give feedback.
-
@adrianeboyd Thanks For given Way. Apply Input Text : "A 50-year-old male patient lodges chief complaint pain in lower right side of chest , vomiting , high cholesterol for three days associated with burning in epigastrium for until chest pain is revealed. history of high blood pressure and high cholesterol 100 mg. " Apply below pattern, {"label":"1","pattern":[{"ENT_TYPE": "cc" } , {"ENT_TYPE": "cc" } ,{ "LOWER" : "for" } , {"ENT_TYPE": "time_unit" } ]} Can Join 3 CC Ent join with Time_unit Ent ? also tried 3 time pattern added then get below outcome, 2nd points, |
Beta Was this translation helpful? Give feedback.
Using token patterns, each
{}
pattern matches exactly one token by default, so for this pattern you end up with the matched token "chest":To match one or more tokens, you can use:
Docs on operators: https://spacy.io/usage/rule-based-matching#quantifiers
If you might ever have two adjacent entity spans (e.g. something like "following a week of [intense headaches] [chest pain] for three days") and you only want to match one of the spans, you'd need to also include the
ENT_IOB
features so you can match only one entity based on the IOB tags:Alternatively, you…