-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
⭐️ EnhancementNew feature or requestNew feature or request
Description
It would be nice if there were convenience upload/download methods that directly accept DKPro Cassis Cas objects.
For uploading, the Cas object can be serialized to XMI and uploaded.
For downloading, INCEpTION exports XMIs actually as ZIP files containing a type system file and the XMI file - this can be converted to a Cas object using code like this:
with TemporaryDirectory() as tmpdir:
with ZipFile(BytesIO(pycaprio.api.annotation(1, 4, annotation_format=InceptionFormat.XMI))) as xmi_zip:
type_system = load_typesystem(BytesIO(xmi_zip.read('TypeSystem.xml')))
for i in xmi_zip.filelist:
if i.filename.endswith('.xmi'):
cas = load_cas_from_xmi(BytesIO(xmi_zip.read(i)), typesystem=type_system)
break # There is only one XMI per ZIP
Metadata
Metadata
Assignees
Labels
⭐️ EnhancementNew feature or requestNew feature or request