def test_remove_duplicates_different_entity_no_removal(self): # test same result with different score will return only the highest arr = [ RecognizerResult(start=0, end=5, score=0.1, entity_type="x", analysis_explanation=AnalysisExplanation( recognizer='test', original_score=0, pattern_name='test', pattern='test', validation_result=None)), RecognizerResult(start=0, end=5, score=0.5, entity_type="y", analysis_explanation=AnalysisExplanation( recognizer='test', original_score=0, pattern_name='test', pattern='test', validation_result=None)) ] results = AnalyzerEngine._AnalyzerEngine__remove_duplicates(arr) assert len(results) == 2
def test_remove_duplicates(): # test same result with different score will return only the highest arr = [ RecognizerResult( start=0, end=5, score=0.1, entity_type="x", analysis_explanation=AnalysisExplanation( recognizer="test", original_score=0, pattern_name="test", pattern="test", validation_result=None, ), ), RecognizerResult( start=0, end=5, score=0.5, entity_type="x", analysis_explanation=AnalysisExplanation( recognizer="test", original_score=0, pattern_name="test", pattern="test", validation_result=None, ), ), ] results = AnalyzerEngine._AnalyzerEngine__remove_duplicates(arr) assert len(results) == 1 assert results[0].score == 0.5