@staticmethod
def __remove_duplicates(results):
    """
        Removes each result which has a span contained in a
        result's span with a higher score
        :param results: List[RecognizerResult]
        :return: List[RecognizerResult]
        """
    results = sorted(results, key=lambda x: (-x.score, x.start, x.end - x.
        start))
    filtered_results = []
    for result in results:
        if result.score == 0:
            continue
        valid_result = True
        if result not in filtered_results:
            for filtered in filtered_results:
                if result.contained_in(filtered
                    ) and result.entity_type == filtered.entity_type:
                    valid_result = False
                    break
        if valid_result:
            filtered_results.append(result)
    return filtered_results
