Skip to content

Commit

Permalink
folia2stam: minor syntax fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Nov 1, 2023
1 parent ea84c8f commit 07e36a1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions foliatools/folia2stam.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ def convert_tokens(doc: folia.Document, annotationstore: stam.AnnotationStore, *
data=token["data"])

word_folia = doc[token["id"]]
convert_inline_annotation(word_folia, word_stam, annotationstore, **kwargs )
if word_folia:
convert_inline_annotation(word_folia, word_stam, annotationstore, **kwargs )

return resource

Expand Down Expand Up @@ -404,11 +405,13 @@ def convert_type_information(annotation: folia.AbstractElement) -> Generator[dic
"key": "elementtype",
"value": annotation.XMLTAG}
if annotation.ANNOTATIONTYPE:
value = folia.annotationtype2str(annotation.ANNOTATIONTYPE).lower()
yield {"set": FOLIA_NAMESPACE,
"id":f"{FOLIA_NAMESPACE}annotationtype/{value}",
"key":"annotationtype",
"value":value}
value = folia.annotationtype2str(annotation.ANNOTATIONTYPE)
if value:
value = value.lower()
yield {"set": FOLIA_NAMESPACE,
"id":f"{FOLIA_NAMESPACE}annotationtype/{value}",
"key":"annotationtype",
"value":value}

def convert_common_attributes(annotation: folia.AbstractElement) -> Generator[dict,None,None]:
"""Convert common FoLiA attributes"""
Expand Down

0 comments on commit 07e36a1

Please sign in to comment.