mirror of
https://github.com/explosion/spaCy.git
synced 2025-04-22 01:51:58 +03:00
mypy fix for integer type infinity
This commit is contained in:
parent
9252e62477
commit
02c1bc03c8
|
@ -148,6 +148,11 @@ def span_finder_score(
|
|||
return scores
|
||||
|
||||
|
||||
class _MaxInt(int):
|
||||
def __le__(self, other):
|
||||
return False
|
||||
|
||||
|
||||
class SpanFinder(TrainablePipe):
|
||||
"""Pipeline that learns span boundaries"""
|
||||
|
||||
|
@ -184,15 +189,16 @@ class SpanFinder(TrainablePipe):
|
|||
self.vocab = nlp.vocab
|
||||
self.threshold = threshold
|
||||
if max_length is None:
|
||||
max_length = float("inf")
|
||||
max_length = _MaxInt()
|
||||
if min_length is None:
|
||||
min_length = 1
|
||||
|
||||
self.min_length = min_length
|
||||
self.max_length = max_length
|
||||
if max_length < 1 or min_length < 1:
|
||||
raise ValueError(
|
||||
Errors.E1052.format(min_length=min_length, max_length=max_length)
|
||||
)
|
||||
self.max_length = max_length
|
||||
self.min_length = min_length
|
||||
self.predicted_key = predicted_key
|
||||
self.training_key = training_key
|
||||
self.model = model
|
||||
|
|
Loading…
Reference in New Issue
Block a user