def _filter_match(self, span: span, relations: Dict, patterns: List) -> bool:
        """
        Filter the match result according to prefix, suffix, min, max ...
        Args:
            span: span
            relations: Dict
            patterns: List of pattern

        Returns: bool
        """

        for pattern_id, a_pattern in enumerate(patterns):
            token_range = relations[pattern_id]
            if token_range:
                tokens = [x for x in span[token_range[0]:token_range[1]]]
                if a_pattern.type == "word":
                    if not self._pre_suf_fix_filter(tokens, a_pattern.prefix, a_pattern.suffix):
                        return False
                if a_pattern.type == "shape":
                    if not (self._full_shape_filter(tokens, a_pattern.full_shape)
                            and self._pre_suf_fix_filter(tokens, a_pattern.prefix,a_pattern.suffix)):
                        return False
                if a_pattern.type == "number":
                    if not self._min_max_filter(tokens, a_pattern.min, a_pattern.max):
                        return False
        return True
def _filter_match ( self , span : span , relations : Dict , patterns : List ) -> bool : for pattern_id , a_pattern in enumerate ( patterns ) : token_range = relations [ pattern_id ] if token_range : tokens = [ x for x in span [ token_range [ 0 ] : token_range [ 1 ] ] ] if a_pattern . type == "word" : if not self . _pre_suf_fix_filter ( tokens , a_pattern . prefix , a_pattern . suffix ) : return False if a_pattern . type == "shape" : if not ( self . _full_shape_filter ( tokens , a_pattern . full_shape ) and self . _pre_suf_fix_filter ( tokens , a_pattern . prefix , a_pattern . suffix ) ) : return False if a_pattern . type == "number" : if not self . _min_max_filter ( tokens , a_pattern . min , a_pattern . max ) : return False return True
Filter the match result according to prefix, suffix, min, max ...
        Args:
            span: span
            relations: Dict
            patterns: List of pattern

        Returns: bool