Why is there no on_match callback on rulers #12265
rafelafrance
started this conversation in
New Features & Project Ideas
Replies: 1 comment 2 replies
-
Hey @rafelafrance, the reason for this is that |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I just started resurrecting some old spaCy rule-based parsers and I noticed some great new-to-me rulers that do not have an
on_match
callback. The entity and span rulers would really fit well with my particular workflow if they had callbacks.There's probably a good reason for this aside from the matcher/ruler naming difference. I'm curious what it is.
My use case is pretty common, I build up bigger patterns from smaller patterns and capture details along the way. For instance:
Leaf (12-)23-34 × 45-56 cm
(12-)23-34
&45-56
using a pattern that is roughly:{"TEXT": {"IN": " ( [ ".split()}}
{"TEXT": {"REGEX": r"^{(\d+\.?\d*)}$"}}
{"TEXT": {"IN": " – - –– -- ".split()}}
{"TEXT": {"IN": " ) ] ".split()}}
on_match
callback put the valuesmin=12
,low=23
,high=34
etc. in the range entity'sent._.data
dict.range cm? x range cm
ent._.data
and match them to the dimensions etc.Steps 3 & 5 are the problem. This is simplified of course. And, to be honest, I'm probably not using features that spaCy already provides to their best use.
Beta Was this translation helpful? Give feedback.
All reactions