From fe4c094d86e8833ecbe5976c69aa88a61f0e3d28 Mon Sep 17 00:00:00 2001 From: kadarakos Date: Wed, 3 May 2023 11:57:18 +0000 Subject: [PATCH] implement all comparison operators for inf int --- spacy/pipeline/span_finder.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spacy/pipeline/span_finder.py b/spacy/pipeline/span_finder.py index d761ea5a2..6ad27bfb7 100644 --- a/spacy/pipeline/span_finder.py +++ b/spacy/pipeline/span_finder.py @@ -152,6 +152,15 @@ class _MaxInt(int): def __le__(self, other): return False + def __lt__(self, other): + return False + + def __ge__(self, other): + return True + + def __gt__(self, other): + return True + class SpanFinder(TrainablePipe): """Pipeline that learns span boundaries""" @@ -192,7 +201,6 @@ class SpanFinder(TrainablePipe): max_length = _MaxInt() if min_length is None: min_length = 1 - if max_length < 1 or min_length < 1: raise ValueError( Errors.E1052.format(min_length=min_length, max_length=max_length)