OpenParable
Skip to content
← Back to skills

Punctuation Normalizer

Documents
punctuation_normalizer

Punctuation Normalizer is an Agent Skill for documents published in the cas-bigdatalab/piflow repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

文本标点规范化工具。只处理标点本身:合并重复标点、统一中英文标点与引号样式、规范省略号和标点周围空格。 当用户提到标点规范化、标点清理、合并重复标点、全半角转换等需求时使用此skill。 适用于科研文本中标点混乱、重复符号过多的场景,不负责 HTML、表情、数字或拼写清理。

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/cas-bigdatalab/piflow/blob/HEAD/workspace/skills/punctuation_normalizer/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/punctuation-normalizer, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Punctuation Normalizer 文本标点规范化 Skill

功能概述

文本标点规范化工具,读取结构化或半结构化文本文件,合并重复标点、统一标点与引号样式、清理标点周围空格并保留省略号。 适用于科研文本中标点混乱、连续符号过多、引号样式不统一的标点规整场景。

触发条件

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

  • 标点规范化
  • 标点清理
  • 合并重复标点
  • 统一中英文标点
  • 引号或省略号规整

核心参数说明

必需参数

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

可选参数

  • --merge_repeated:是否合并重复标点,默认 true。
  • --max_repeat:允许的最大重复次数,默认 1。
  • --normalize_width:全半角规范化模式,默认 auto。
  • --normalize_quotes:是否规范化引号,默认 true。
  • --quote_style:引号风格,默认 chinese。
  • --normalize_ellipsis:是否规范化省略号,默认 true。
  • --remove_space_around_punct:是否移除标点周围的多余空格,默认 true。
  • --text_field:JSON/JSONL 输入时的文本字段名,默认 text。

输入文件格式

  • csv:处理文本列并保持表头与其他列不变。
  • json / jsonl:处理指定文本字段。
  • txt / md:按单文本内容处理。

使用方法

python scripts/run_punctuation_normalizer.py --input input.csv --output output.csv
python scripts/run_punctuation_normalizer.py --input input.jsonl --output output.jsonl --quote_style english

处理示例

  • Wait!!! Really??? → Wait! Really?
  • 中文!!!真的吗????好的。。 → 中文!真的吗?好的……
  • “Smart quotes” and ‘single quotes’ → “Smart quotes” and ‘single quotes’
  • Ellipsis...... → Ellipsis……
  • Extra spaces before text → Extra spaces before text

输出示例

[OK] Punctuation normalization completed!
   Total samples: 10
   Modified samples: 6 (60.0%)
   Unchanged samples: 4 (40.0%)
   Modifications:
     - Merged repeated punctuation: 3
     - Normalized width: 2
     - Normalized quotes: 0
     - Normalized ellipsis: 2
     - Removed extra spaces: 1

环境要求

  • Python 3.10+
  • 仅依赖标准库

注意事项

  1. auto 模式按中英文字符比例选择半角归一策略。
  2. 省略号统一保留为 ……。
  3. 不处理 HTML、表情、数字或拼写问题。
  4. 输出会保留原始行列结构和未修改字段。