From 7e29a93da59d8c0556dcb57749cd957b38250205 Mon Sep 17 00:00:00 2001 From: Arne Binder Date: Thu, 19 Jun 2025 22:58:22 +0200 Subject: [PATCH 1/2] never return remainings that are longer than 6 --- .../taskmodules/pointer_network/annotation_encoder_decoder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pie_modules/taskmodules/pointer_network/annotation_encoder_decoder.py b/src/pie_modules/taskmodules/pointer_network/annotation_encoder_decoder.py index 5d48629bd..2aab177a3 100644 --- a/src/pie_modules/taskmodules/pointer_network/annotation_encoder_decoder.py +++ b/src/pie_modules/taskmodules/pointer_network/annotation_encoder_decoder.py @@ -382,8 +382,8 @@ def parse(self, encoding: List[int]) -> Tuple[List[BinaryRelation], Dict[str, in for i in encoding: current_encoding.append(i) # An encoding is complete when it ends with a relation_id - # or when it contains a none_id and has a length of 7 - if i in relation_ids or (i == none_id and len(current_encoding) == 7): + # or when it has a length of 7 + if i in relation_ids or len(current_encoding) == 7: # try to decode the current relation encoding try: valid_encoding = self.decode(encoding=current_encoding) From 61a1ff31f042842d7c263dae754b93e568819ce6 Mon Sep 17 00:00:00 2001 From: Arne Binder Date: Tue, 24 Jun 2025 14:30:46 +0200 Subject: [PATCH 2/2] improve comment --- .../pointer_network/annotation_encoder_decoder.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pie_modules/taskmodules/pointer_network/annotation_encoder_decoder.py b/src/pie_modules/taskmodules/pointer_network/annotation_encoder_decoder.py index 2aab177a3..639df0da1 100644 --- a/src/pie_modules/taskmodules/pointer_network/annotation_encoder_decoder.py +++ b/src/pie_modules/taskmodules/pointer_network/annotation_encoder_decoder.py @@ -381,8 +381,10 @@ def parse(self, encoding: List[int]) -> Tuple[List[BinaryRelation], Dict[str, in if len(encoding): for i in encoding: current_encoding.append(i) - # An encoding is complete when it ends with a relation_id - # or when it has a length of 7 + # An encoding is complete when it ends with a relation_id or when it has + # a length of 7, encodings with length above 7 are never valid. Note that + # all incomplete encodings (the 3rd return value of this method) need to + # be processable by build_decoding_constraints! if i in relation_ids or len(current_encoding) == 7: # try to decode the current relation encoding try: