[docs]@OPERATORS.register_module("remove_specific_chars_mapper")classRemoveSpecificCharsMapper(Mapper):"""Mapper to clean specific chars in text samples."""_batched_op=True
[docs]def__init__(self,chars_to_remove:Union[str,List[str]]="◆●■►▼▲▴∆▻▷❖♡□",*args,**kwargs):""" Initialization method. :param chars_to_remove: a list or a string including all characters that need to be removed from text. :param args: extra args :param kwargs: extra args """super().__init__(*args,**kwargs)ifchars_to_remove:self.pattern="["+"|".join(chars_to_remove)+"]"else:self.pattern=None