From 33e6a1b4b6b1ce1c68e2d3bd5263563bea5f0dfd Mon Sep 17 00:00:00 2001 From: Arne Binder Date: Mon, 19 Feb 2024 20:55:48 +0100 Subject: [PATCH] add disrespect_decoded_annotations parameter to parse_with_error_handling() --- src/pie_modules/taskmodules/common/interfaces.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pie_modules/taskmodules/common/interfaces.py b/src/pie_modules/taskmodules/common/interfaces.py index 31a9e6dff..0d5915a2d 100644 --- a/src/pie_modules/taskmodules/common/interfaces.py +++ b/src/pie_modules/taskmodules/common/interfaces.py @@ -70,6 +70,7 @@ def parse_with_error_handling( stop_ids: List[int], errors: Optional[Dict[str, int]] = None, decoded_annotations: Optional[List[A]] = None, + disrespect_decoded_annotations: bool = False, ) -> Tuple[List[A], Dict[str, int], List[int]]: errors = errors or defaultdict(int) decoded_annotations = decoded_annotations or [] @@ -84,7 +85,9 @@ def parse_with_error_handling( try: valid_encoding, remaining = self.parse( encoding=remaining, - decoded_annotations=decoded_annotations, + decoded_annotations=decoded_annotations + if not disrespect_decoded_annotations + else [], text_length=input_length, ) decoded_annotations.append(valid_encoding)