About novel-truncator
novel-truncator is a skill for shortening novel-length text to a character limit. It favors sentence and paragraph boundaries while avoiding mid-word cuts and reporting the resulting length and cutoff point.
Key features
- 01Truncate text to a character limit
- 02Prefer sentence endings
- 03Fall back to paragraph or newline boundaries
- 04Avoid cutting words in half
- 05Report output length and cutoff point
Use cases
- 01Prepare novel text to meet a length limit
- 02Create bounded text input for other Agents
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ vangong1999/ screen-creative-skills --skill novel-truncatorAfter installing, type/novel-truncatorin Claude Code to confirm it loaded.
Bundled filesreferences/examples.mdscripts/novel_truncator.py
Details
From the project README文本截断工具(小说版)
功能
接收文本内容与最大长度限制,智能截断文本,保持内容完整性。
使用场景
- 对长篇小说文本进行预处理,使其符合长度限制。
- 在不破坏语义完整性的前提下,截取文本片段。
- 确保输入到其他智能体的文本不超过其处理能力。
截断原则
- 优先句子结束: 在句号、问号、感叹号处断开。
- 其次段落结束: 在空格、换行符处断开。
- 最后指定长度: 确保不超过设定的最大长度限制。
输入要求
- 文本内容: 待截断的原始文本(字符串)。
- 最大长度限制: 目标文本的最大字符数(整数)。
- 截断标记(可选): 用于标识文本截断位置的字符串,如 "[...]"。
输出格式
【文本截断报告】
原始长度:[字符数]
截断后长度:[字符数]
截断位置:[位置描述,如:在第 X 句句号处]
截断后的文本:
[文本内容]
约束条件
- 截断过程应最大限度地保留原文的语义和语境完整性。
- 严格遵守最大长度限制。
- 避免在词语中间进行截断。
参考资料
Comments
Markdown supported