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
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
The text was updated successfully, but these errors were encountered:
But for upload, they'd normally come from files, e.g.:
with open('typesystem.xml', 'rb') as f:
typesystem = load_typesystem(f)
with open('cas.xml', 'rb') as f:
cas = load_cas_from_xmi(f, typesystem=typesystem)
of if the user has exported an XMI for example from the INCEpTION annotation page, then it's the same as above with the type system and XMI files being in a ZIP.
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:The text was updated successfully, but these errors were encountered: