(self, s, **kwargs)
return final_text_to_remove
this is a bit mind-boggling.
        apply normalization steps one-by-one and keep track of mapping from one step to the next
        iteratively apply mappings (in reverse) on each step's removal inds to get inds in original string
this is a bit mind-boggling.
        apply normalization steps one-by-one and keep track of mapping from one step to the next
        iteratively apply mappings (in reverse) on each step's removal inds to get inds in original string
this is a bit mind - boggling . apply normalization steps one - by - one and keep track of mapping from one step to the next iteratively apply mappings ( in reverse ) on each step s removal inds to get inds in original string
def find_text_to_remove(self, s, **kwargs):
        """
        this is a bit mind-boggling.
        apply normalization steps one-by-one and keep track of mapping from one step to the next
        iteratively apply mappings (in reverse) on each step's removal inds to get inds in original string
        """
        all_text_to_remove = []
        mappings = []
        snorm = s
        for step in self.steps:
            temp_text_to_remove = step.find_text_to_remove(snorm)
            if len(temp_text_to_remove) == 0:
                text_to_remove_inds, text_to_remove_repls = [], []
            else:
                text_to_remove_inds, text_to_remove_repls = zip(*temp_text_to_remove)
            for mapping in reversed(mappings):
                text_to_remove_inds = step.convert_normalized_indices_to_unnormalized_indices(text_to_remove_inds, mapping)
            temp_text_to_remove = list(zip(text_to_remove_inds, text_to_remove_repls))
            all_text_to_remove += [temp_text_to_remove]
            mappings += [step.get_mapping_after_normalization(snorm)]
            snorm = step.normalize(snorm)
        # merge any overlapping ranges
        # later edits should override earlier ones
        final_text_to_remove = reduce(lambda a, b: self.merge_removal_inds(a, b), all_text_to_remove)
        final_text_to_remove.sort(key=lambda x: x[0])
        return final_text_to_remove
def find_text_to_remove ( self , s , * * kwargs ) : all_text_to_remove = [ ] mappings = [ ] snorm = s for step in self . steps : temp_text_to_remove = step . find_text_to_remove ( snorm ) if len ( temp_text_to_remove ) == 0 : text_to_remove_inds , text_to_remove_repls = [ ] , [ ] else : text_to_remove_inds , text_to_remove_repls = zip ( * temp_text_to_remove ) for mapping in reversed ( mappings ) : text_to_remove_inds = step . convert_normalized_indices_to_unnormalized_indices ( text_to_remove_inds , mapping ) temp_text_to_remove = list ( zip ( text_to_remove_inds , text_to_remove_repls ) ) all_text_to_remove += [ temp_text_to_remove ] mappings += [ step . get_mapping_after_normalization ( snorm ) ] snorm = step . normalize ( snorm ) # merge any overlapping ranges # later edits should override earlier ones final_text_to_remove = reduce ( lambda a , b : self . merge_removal_inds ( a , b ) , all_text_to_remove ) final_text_to_remove . sort ( key = lambda x : x [ 0 ] ) return final_text_to_remove