From 4a9c871098466ad0c7a3b323a6771815646b658a Mon Sep 17 00:00:00 2001 From: Arne Binder Date: Tue, 7 Nov 2023 20:13:13 +0100 Subject: [PATCH] fix example_to_document() / document_to_example(): use "attributions" to access the attributes because the base dataset loader still produces this --- dataset_builders/pie/brat/brat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dataset_builders/pie/brat/brat.py b/dataset_builders/pie/brat/brat.py index aa70cca1..56b55db6 100644 --- a/dataset_builders/pie/brat/brat.py +++ b/dataset_builders/pie/brat/brat.py @@ -130,7 +130,7 @@ def example_to_document( attribute_annotations: Dict[str, Dict[str, Attribute]] = defaultdict(dict) attribute_ids = [] - for attribute_dict in dl2ld(example["attributes"]): + for attribute_dict in dl2ld(example["attributions"]): target_id = attribute_dict["target"] if target_id in spans: target_layer_name = "spans" @@ -264,7 +264,7 @@ def document_to_example( ) attribute_dicts[attribute_annotation] = attribute_dict - example["attributes"] = ld2dl( + example["attributions"] = ld2dl( list(attribute_dicts.values()), keys=["id", "type", "target", "value"] ) example["normalizations"] = ld2dl(