-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
Basic matcher terminology example fails,
Bug or coding error ?
import edsnlp
import edsnlp.pipes as eds
nlp = edsnlp.blank("eds")
nlp.add_pipe(eds.normalizer())
nlp.add_pipe("sentencizer")
terms = {
"diabete": ["diabète", "diabete", "diabetes"],
"hta": ["hypertension artérielle", "HTA"]
}
nlp.add_pipe(
eds.matcher(
terms=terms,
attr="NORM",
term_matcher="exact"
),
name="terminology"
)
nlp.add_pipe(eds.negation())
nlp.add_pipe(eds.family())
nlp.add_pipe(eds.hypothesis())
print("Pipeline components:", nlp.pipe_names)
doc = nlp("Pas de diabète. Le père a une hypertension artérielle.")
print("Available spans:", doc.spans.keys())
for ent in doc.spans["terminology"]:
print(ent.text, ent.label_, ent._.negation_, ent._.family_, ent._.hypothesis_)
# ...
2025-06-01 20:52:02.612 | WARNING | edsnlp.pipes.qualifiers.family.family:__init__:171 - You have requested that the pipeline use annotations provided by the `section` pipeline, but it was not set. Skipping that step.
Pipeline components: ['normalizer', 'sentencizer', 'terminology', 'negation', 'family', 'hypothesis']
Available spans: KeysView({'pollutions': []})
Traceback (most recent call last):
File "test.py", line 33, in <module>
for ent in doc.spans["terminology"]:
~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/collections/__init__.py", line 1124, in __getitem__
raise KeyError(key)
KeyError: 'terminology'
My Environment
Debian GNU/Linux 12 (bookworm)
Python: 3.11.2
edsnlp: 0.17.1
spacy: 3.8.6
Metadata
Metadata
Assignees
Labels
No labels