Skip to content

Commit

Permalink
folia2stam: don't duplicate set ID in data ID
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Nov 1, 2023
1 parent 07e36a1 commit 517e8d0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions foliatools/folia2stam.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,15 +401,15 @@ def convert_span_annotation(doc: folia.Document, annotationstore: stam.Annotatio
def convert_type_information(annotation: folia.AbstractElement) -> Generator[dict,None,None]:
if annotation.XMLTAG:
yield { "set":FOLIA_NAMESPACE,
"id": f"{FOLIA_NAMESPACE}elementtype/{annotation.XMLTAG}",
"id": f"elementtype/{annotation.XMLTAG}",
"key": "elementtype",
"value": annotation.XMLTAG}
if annotation.ANNOTATIONTYPE:
value = folia.annotationtype2str(annotation.ANNOTATIONTYPE)
if value:
value = value.lower()
yield {"set": FOLIA_NAMESPACE,
"id":f"{FOLIA_NAMESPACE}annotationtype/{value}",
"id":f"annotationtype/{value}",
"key":"annotationtype",
"value":value}

Expand All @@ -426,7 +426,7 @@ def convert_common_attributes(annotation: folia.AbstractElement) -> Generator[di

if annotation.confidence is not None:
yield {"set":FOLIA_NAMESPACE,
"id":f"{FOLIA_NAMESPACE}confidence/{annotation.confidence}",
"id":f"confidence/{annotation.confidence}",
"key":"confidence",
"value":annotation.confidence}

Expand All @@ -443,7 +443,7 @@ def convert_common_attributes(annotation: folia.AbstractElement) -> Generator[di
if annotation.datetime is not None:
value = annotation.datetime.strftime("%Y-%m-%dT%H:%M:%S")
yield { "set":FOLIA_NAMESPACE,
"id":f"{FOLIA_NAMESPACE}datetime/{value}",
"id":f"datetime/{value}",
"key":"datetime",
"value":value} #MAYBE TODO: convert to STAM's internal datetime type?

Expand All @@ -455,7 +455,7 @@ def convert_common_attributes(annotation: folia.AbstractElement) -> Generator[di
"key":"processor/name",
"value":annotation.processor.name}
yield { "set":FOLIA_NAMESPACE,
"id":f"{FOLIA_NAMESPACE}processor/type/{annotation.processor.type}",
"id":f"processor/type/{annotation.processor.type}",
"key":"processor/type",
"value":annotation.processor.type}

Expand Down

0 comments on commit 517e8d0

Please sign in to comment.