You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I would like to mix up both the Span Marker model with Spacy integration(https://spacy.io/universe/project/span_marker) and the entity ruler (to add some custom patterns), similar like in the code from below.
`import spacy
import de_dep_news_trf
Hi. I would like to mix up both the Span Marker model with Spacy integration(https://spacy.io/universe/project/span_marker) and the entity ruler (to add some custom patterns), similar like in the code from below.
`import spacy
import de_dep_news_trf
nlp = de_dep_news_trf.load()
patterns = [{"label": "PERIOD", "pattern": [{"LOWER": "monat"}]},
{"label": "PER", "pattern": "Raluca"},
{"label": "COLOR", "pattern": [{"LOWER": "blau"}]},
{"label": "JOBTITLE", "pattern": [{"LOWER" : {"REGEX": ".(referent)."}}]}
]
ruler = nlp.add_pipe("entity_ruler")
ruler.add_patterns(patterns)
span_marker_ruler = nlp.add_pipe('span_marker', config={"model": "tomaarsen/span-marker-mbert-base-multinerd"}, name='span_marker_ruler')
doc = nlp("Raluca ist referent, er mag die Farbe Blau und geht jeden Monat in die Berge.")
print([(ent.text, ent.label_) for ent in doc.ents])`
Unfortunately, this mix doesn't work properly.
I would expect however an output like this
`
[('Raluca', 'PER'), ('referent', 'JOBTITLE'), ('Blau', 'COLOR'), ('Monat', 'PERIOD')]
`
How to integrate entity ruler (with add of some customized entities and patterns) with the Span Marker model?
Do you have any ideas on how to solve this kind of issues?
The text was updated successfully, but these errors were encountered: