data_juicer.ops.mapper.replace_content_mapper module

class data_juicer.ops.mapper.replace_content_mapper.ReplaceContentMapper(pattern: str | List[str] | None = None, repl: str | List[str] = '', *args, **kwargs)[源代码]

基类:Mapper

Mapper to replace all content in the text that matches a specific regular expression pattern with a designated replacement string.

__init__(pattern: str | List[str] | None = None, repl: str | List[str] = '', *args, **kwargs)[源代码]

Initialization method.

参数:
  • pattern -- regular expression pattern(s) to search for within text

  • repl -- replacement string(s), default is empty string

  • args -- extra args

  • kwargs -- extra args

process_batched(samples)[源代码]