# clean_copyright_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. 清理文本样本开头的版权声明。 该算子从文本样本的开头删除版权声明。它使用正则表达式识别并删除包含“copyright”一词的多行注释。它还贪心地删除文本开头以注释标记如 `//`, `#` 或 `--` 开头的行,因为这些通常是版权声明的一部分。该算子单独处理每个样本,但为了效率也可以批量处理。 Type 算子类型: **mapper** Tags 标签: cpu, text ## 🔧 Parameter Configuration 参数配置 | name 参数名 | type 类型 | default 默认值 | desc 说明 | |--------|------|--------|------| | `args` | | `''` | extra args | | `kwargs` | | `''` | extra args | ## 📊 Effect demonstration 效果演示 ### test_clean_copyright ```python CleanCopyrightMapper() ``` #### 📥 input data 输入数据
['这是一段 /* 多行注释\n注释内容copyright\n*/ 的文本。另外还有一些 // 单行注释。', '如果多行/*注释中没有\n关键词,那么\n这部分注释也不会\n被清除*/\n会保留下来', '//if start with\n//that will be cleaned \n evenly', 'http://www.nasosnsncc.com', '#if start with\nthat will be cleaned \n#evenly', '--if start with\n--that will be cleaned \n#evenly']
['这是一段 的文本。另外还有一些 // 单行注释。', '如果多行/*注释中没有\n关键词,那么\n这部分注释也不会\n被清除*/\n会保留下来', ' evenly', 'http://www.nasosnsncc.com', 'that will be cleaned \n#evenly', '']