mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 01:48:04 +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
 | 
					    return scores
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class _MaxInt(int):
 | 
				
			||||||
 | 
					    def __le__(self, other):
 | 
				
			||||||
 | 
					        return False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class SpanFinder(TrainablePipe):
 | 
					class SpanFinder(TrainablePipe):
 | 
				
			||||||
    """Pipeline that learns span boundaries"""
 | 
					    """Pipeline that learns span boundaries"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -184,15 +189,16 @@ class SpanFinder(TrainablePipe):
 | 
				
			||||||
        self.vocab = nlp.vocab
 | 
					        self.vocab = nlp.vocab
 | 
				
			||||||
        self.threshold = threshold
 | 
					        self.threshold = threshold
 | 
				
			||||||
        if max_length is None:
 | 
					        if max_length is None:
 | 
				
			||||||
            max_length = float("inf")
 | 
					            max_length = _MaxInt()
 | 
				
			||||||
        if min_length is None:
 | 
					        if min_length is None:
 | 
				
			||||||
            min_length = 1
 | 
					            min_length = 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        self.min_length = min_length
 | 
				
			||||||
 | 
					        self.max_length = max_length
 | 
				
			||||||
        if max_length < 1 or min_length < 1:
 | 
					        if max_length < 1 or min_length < 1:
 | 
				
			||||||
            raise ValueError(
 | 
					            raise ValueError(
 | 
				
			||||||
                Errors.E1052.format(min_length=min_length, max_length=max_length)
 | 
					                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.predicted_key = predicted_key
 | 
				
			||||||
        self.training_key = training_key
 | 
					        self.training_key = training_key
 | 
				
			||||||
        self.model = model
 | 
					        self.model = model
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user