When using the native MMIF annotation getter mmif[anno.id], the SDK throws a KeyError. When using view-scoped long ids (mmif[anno.long_id]), it works as expected.
Reproduction steps
Using a MMIF file (version 1.0.4), try to access a given annotation via mmif[id], where id is a short annotation ID.
Expected behavior
>>> for anno in mmif["v_0"].annotations:
... anno = mmif[anno.id]
Should successfully access a MMIF Annotation object in each iteration
Log output
>>> with open("spacy1.mmif", "r") as f:
... mmif = Mmif(f.read())
...
>>> for anno in mmif["v_0"].annotations:
... anno = mmif[anno.id]
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/home/hmccormick/.local/lib/python3.9/site-packages/mmif/serialize/mmif.py", line 590, in __getitem__
raise KeyError("ID not found: %s" % item)
KeyError: 'ID not found: to_1'
>>> for anno in mmif["v_0"].annotations:
... anno = mmif[anno.long_id]
>>> # Works without error on long IDs
Bug Description
When using the native MMIF annotation getter
mmif[anno.id]
, the SDK throws a KeyError. When using view-scoped long ids (mmif[anno.long_id]
), it works as expected.Reproduction steps
Using a MMIF file (version 1.0.4), try to access a given annotation via
mmif[id]
, whereid
is a short annotation ID.Expected behavior
Should successfully access a MMIF Annotation object in each iteration
Log output
Screenshots
No response
Additional context
No response