Skip to content
cccskills
FreePublished on GitHub

text_splitter

长文本规则切分工具。将超长文本按照段落、句子、固定字符长度、非空行或科研论文章节标题进行自动切分,生成粒度均匀的短文本片段。当用户提到文本切分、长文本拆分、按段落分割、按句子分割、文本分块、论文章节切分等需求时使用此skill。

适用于科研论文、实验综述、长篇文稿等资料的粒度拆分需求。不负责采样、清洗、格式转换或PDF解析。

The English summary is being prepared. Showing the original description.

Run score Not tested

See how to install

Files included (4)

  • SKILL.md6.6 KB
  • scripts/example_input.json185 B
  • scripts/run_text_splitter.py25.5 KB
  • skill.json5.0 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Text Splitter 长文本规则切分 Skill

功能概述

本skill用于将超长文本按照指定规则进行切分,生成粒度均匀的短文本片段。支持段落、句子、固定长度、非空行以及科研论文章节标题切分,适配科研论文、实验综述、长篇文稿等资料的粒度拆分需求。

触发条件

当用户请求以下任务时,应使用此skill:

  • 长文本切分/拆分
  • 按段落分割文本
  • 按句子分割文本
  • 文本分块/分片
  • 论文章节切分/按摘要引言方法结论分割
  • 将长文档拆成短片段

核心参数说明

必需参数

  • --input:输入文件路径
  • --output:输出文件路径

可选参数

  • --split_mode:paragraph / sentence / length / line / section
  • --max_length:length 模式最大字符数
  • --overlap:length 模式重叠字符数
  • --min_length:最小片段长度
  • --separator:自定义分隔符
  • --output_format:jsonl / txt / json
  • --keep_metadata:是否保留元信息
  • --text_field:JSON/JSONL 输入时的文本字段名
  • --language:section 模式下论文语言
  • --custom_sections:自定义章节标题
  • --include_default:是否包含默认章节关键词
  • --keep_title:section 模式下是否保留标题
  • --min_section_length:section 模式下最小章节长度

输入文件格式

  • 纯文本 (.txt, .md)
  • JSON (.json) - 读取指定字段或数组中的文本字段
  • JSONL (.jsonl) - 逐行处理

切分模式说明

1. 段落模式 (paragraph)

按空行分割文本,适合结构清晰的文档。

2. 句子模式 (sentence)

按句号、问号、感叹号等句末标点分割,适合需要句子级粒度的场景。

3. 长度模式 (length)

按固定字符长度切分,可设置重叠区域,适合需要均匀分块的场景。

4. 行模式 (line)

按非空行切分,每个非空行作为一个片段。

5. 章节模式 (section)

按科研论文章节标题切分,识别摘要、引言、方法、结果、结论、参考文献、附录等标题及其编号变体。

使用方法

按段落切分

python scripts/run_text_splitter.py \
  --input long_document.txt \
  --output chunks.jsonl \
  --split_mode paragraph

按句子切分

python scripts/run_text_splitter.py \
  --input article.txt \
  --output sentences.jsonl \
  --split_mode sentence

按固定长度切分(带重叠)

python scripts/run_text_splitter.py \
  --input paper.txt \
  --output chunks.jsonl \
  --split_mode length \
  --max_length 500 \
  --overlap 50

按科研论文章节切分

python scripts/run_text_splitter.py \
  --input paper.txt \
  --output sections.jsonl \
  --split_mode section \
  --language auto

输出示例

JSONL 格式输出

{"chunk_id": 0, "text": "摘要\n本文研究了...", "section_name": "摘要", "start_pos": 0, "end_pos": 12, "source": "paper.txt"}
{"chunk_id": 1, "text": "引言\n随着科技发展...", "section_name": "引言", "start_pos": 13, "end_pos": 28, "source": "paper.txt"}

执行结果

[OK] Text split completed!
   Input file: paper.txt
   Split mode: section
   Language: zh
   Split count: 8
   Output file: sections.jsonl
   Average chunk length: 390 chars

注意事项

  1. 句子模式同时支持中文(。!?)和英文(.!?)句末标点
  2. 长度模式切分时会尽量在词边界处断开,避免截断词语
  3. 过短的片段(低于min_length)会被合并到相邻片段
  4. JSONL 输入默认处理每行的 "text" 字段,可通过 text_field 指定其他字段
  5. 章节模式识别基于行首匹配,支持带序号格式(如 "1. 引言"、"第一章 引言")
  6. PDF 文件需要先转换为文本再处理

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

领域缩略语展开 Skill:按内置或外部词典将独立缩略语替换为全称,可选在全称后保留原缩写。 适用于技术文本、论文摘要和业务记录中的缩写清洗;不负责模糊缩写消歧或大小写无关替换。

The English summary is being prepared. Showing the original description.

cas-bigdatalab/piflow541Updated Oct 23, 2026

字母数字比例过滤器。过滤文本中字母/数字比例不在指定范围内的样本。 当用户提到文本过滤、比例筛选、字母比例、数字比例、清理乱码文本等需求时使用此skill。 即使用户没有明确说出"过滤",只要任务涉及根据文本中字母或数字的比例来筛选数据, 就应该使用此skill。

The English summary is being prepared. Showing the original description.

cas-bigdatalab/piflow541Updated Oct 23, 2026

平均行长度过滤器。过滤文本平均行长度不在指定范围内的样本。 当用户提到行长度过滤、平均行长度、文本行长度筛选、按行筛选等需求时使用此skill。 即使用户没有明确说出"平均行长度",只要任务涉及根据文本中每行的平均长度来筛选数据, 就应该使用此skill。

The English summary is being prepared. Showing the original description.

cas-bigdatalab/piflow541Updated Oct 23, 2026

批量文件清单采集器。扫描一个或多个本地文件/目录,或从任务列表加载路径, 按支持的扩展名生成文件元信息清单,供后续文本、表格、文档、图像等采集流程继续处理。 当用户需要批量盘点待采集文件、生成本地文件 manifest、统计输入文件类型或为后续采集算子准备文件清单时使用此 skill。

The English summary is being prepared. Showing the original description.

cas-bigdatalab/piflow541Updated Oct 23, 2026

批量数据均匀分片工具。读取json/jsonl/csv输入,按份数或固定条数切成多个子文件,输出一个清单JSON供下游节点消费。 当用户提到数据分割、批量拆分、数据分片、均匀分块等需求时使用此skill。 即使用户没有明确说出"分片",只要任务是把整份批量数据均匀拆成多个文件,就应该使用此skill。 不负责按字段分组导出或随机采样。

The English summary is being prepared. Showing the original description.

cas-bigdatalab/piflow541Updated Oct 23, 2026

本skill是用于单细胞测序数据分析的专用技能,首先需要用户上传需要处理的单细胞测序数据,再对经过预处理的单细胞表达数据进行自动化细胞类型注释。它通过基因比对、数据标准化、降维等一系列流程,将细胞聚类结果与已知参考数据库进行匹配,从而为每个细胞分配生物学功能标签。

The English summary is being prepared. Showing the original description.

cas-bigdatalab/piflow541Updated Oct 23, 2026

See all skills by cas-bigdatalab

Report a problem with this skill