Skip to main content
Ctrl+K

Data Juicer

  • DOCS
  • API
  • Sandbox
  • Hub
  • Agents
  • GitHub
English 简体中文
main v1.4.4 v1.4.3 v1.4.2 v1.4.1 v1.4.0
  • DOCS
  • API
  • Sandbox
  • Hub
  • Agents
  • GitHub
English 简体中文
main v1.4.4 v1.4.3 v1.4.2 v1.4.1 v1.4.0
  • data_juicer.ops.mapper.clean_copyright_mapper module

data_juicer.ops.mapper.clean_copyright_mapper module#

class data_juicer.ops.mapper.clean_copyright_mapper.CleanCopyrightMapper(*args, **kwargs)[source]#

Bases: Mapper

Cleans copyright comments at the beginning of text samples.

This operator removes copyright comments from the start of text samples. It identifies and strips multiline comments that contain the word “copyright” using a regular expression. It also greedily removes lines starting with comment markers like //, #, or – at the beginning of the text, as these are often part of copyright headers. The operator processes each sample individually but can handle batches for efficiency.

__init__(*args, **kwargs)[source]#

Initialization method.

Parameters:
  • args – extra args

  • kwargs – extra args

process_batched(samples)[source]#
On this page
  • CleanCopyrightMapper
    • CleanCopyrightMapper.__init__()
    • CleanCopyrightMapper.process_batched()

This Page

  • Show Source

© Copyright 2024, Data-Juicer Team.

Created using Sphinx 8.2.3.

Built with the PyData Sphinx Theme 0.16.1.