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..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,9 +381,11 @@ 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 contains a none_id and has a length of 7 - if i in relation_ids or (i == none_id and len(current_encoding) == 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: valid_encoding = self.decode(encoding=current_encoding)