← 返回 Skills 市场
wangminrui2022

llm-text-correct

作者 顶尖王牌程序员 · GitHub ↗ · v1.2.4 · MIT-0
cross-platform ⚠ suspicious
223
总下载
0
收藏
0
当前安装
7
版本数
在 OpenClaw 中安装
/install llm-text-correct
功能描述
当用户想要**纠正中文文本错误**、**修改拼写错别字**、**修正语法**、**调整标点**、**润色中文句子**、**检查形近字错误**时自动触发。 使用 pycorrector + MacBERT 专业模型进行高精度中文纠错,准确率远高于普通 LLM 直接提示。 支持直接输入一段文字、长文本,或提供文本文件...
使用说明 (SKILL.md)

\r \r

LLM-Text-Correct\r

\r 功能:使用 pycorrector + MacBERT 专业模型,自动修正中文拼写、形近字、语法、标点等错误。准确率高达 90%+,适合正式文档、文章、聊天记录等需要高精度的中文文本。\r \r

触发时机(Triggers)\r

  • 用户提供一段中文文字,并带有“纠正”“修正”“改错”“检查错别字”“润色”“优化”“语法错误”等关键词。\r
  • 用户说“帮我改一下这段话”“这段文字有问题帮我看看”等口语。\r
  • 支持直接粘贴大段文本,或提供 .txt 文件路径。\r
  • 支持批量:一次提供多个段落或文件。\r \r

支持的模型(推荐顺序)\r

  1. shibing624-macbert4csc-base-chinese → 基于 Transformer(MacBERT)的深度学习纠错模型,效果最佳(推荐默认)。\r
  2. chinese-kenlm-klm → 基于 KenLM 的统计语言模型(N-gram),速度更快但精度稍低。\r \r

核心优势\r

  • 专业模型纠错,比普通 LLM 提示词更准确稳定。\r
  • 支持 GPU 加速(脚本会自动检测)。\r
  • 输出 corrected 版本,并可对比显示修改处。\r \r

参数提取指南\r

当决定调用此技能时,请从用户上下文中提取以下参数:\r \r

  1. \x3C输入文本/路径> (必填): 用户提供的中文文本内容,或文本文件路径(如 /path/to/text.txt)。\r
  2. --refine (选填): 如果用户想要进一步润色或优化风格,可添加此参数。\r
  3. --model-path "\x3C模型路径>" (选填): 用户指定使用特定模型路径时传入,默认自动选择推荐模型。\r \r

执行步骤\r

  1. 识别输入:判断用户是直接给了文本内容,还是提供了文件路径。\r
  2. 默认输出:若未指定输出路径,默认在输入同级创建 [原文件名]_corrected.txt 或直接返回修正后的文本。\r
  3. 调用命令:使用以下兼容性命令启动脚本(优先 python3,失败则 python)。脚本会自动创建虚拟环境、检测 GPU 并安装依赖。\r \r
    (python3 scripts/correct_text.py "\x3C输入文本/路径>" [--refine] [--model-path "\x3C模型路径>"]) || (python scripts/correct_text.py "\x3C输入文本/路径>" [--refine] [--model-path "\x3C模型路径>"])
    
安全使用建议
This skill appears to implement genuine Chinese text-correction functionality, but it has several surprising and potentially risky behaviors you should weigh before installing: - It will perform network downloads from Hugging Face, PyPI and PyTorch servers and may download hundreds of MBs (model weights, wheels). - The code (ensure_package.py) force-reinstalls setuptools in the current Python interpreter as soon as it is imported — that happens before the venv is created and can change your system or user Python environment unexpectedly. - The skill creates a virtual environment outside the skill folder (VENV_DIR up the tree), writes models and logs to disk, and restarts the script under that venv. - If you point the skill at a directory it will recursively process many file types including .py, .json, .js, .css — this can corrupt code or configuration files. The README/SKILL.md emphasize .txt, but the implementation includes many code file extensions. Recommendations before using/installing: - Run the skill in an isolated environment (dedicated VM/container) or inspect/modify the code to avoid global pip changes. In particular, move the setuptools-reinstall call into the venv flow or remove it. - Limit which file extensions it processes (edit get_text_files to restrict to .txt/.md if you only want text). - Verify and, if desired, change VENV_DIR to a safe location inside a sandbox rather than the parent of the skill root. - Backup any directories you plan to process, and test with a small sample first. - If you need stricter control, remove or gate automatic network downloads (snapshot_download) and perform model downloads manually into the expected models directory. If you want, I can provide a suggested patch to (a) stop setuptools being reinstalled on import, (b) restrict processed extensions to safe text files, and (c) keep the venv inside the skill directory or prompt before creating it.
功能分析
Type: OpenClaw Skill Name: llm-text-correct Version: 1.2.4 The skill implements extensive automated environment setup and package management logic in 'env_manager.py' and 'ensure_package.py', which use subprocess to create virtual environments, force-reinstall specific versions of 'setuptools', and install various dependencies from PyPI. It also performs automated downloads of large model artifacts from Hugging Face using 'snapshot_download' in 'correct_text.py'. While these behaviors are functionally aligned with the stated purpose of high-performance Chinese text correction, the broad use of shell execution and remote artifact fetching constitutes a high-risk attack surface.
能力评估
Purpose & Capability
Name/description match core behavior: using pycorrector/KenLM + MacBERT to correct Chinese text. Required binary is only python which is coherent. However there are surprising capabilities: the tool will process many file types (including .py, .json, .js, .css) beyond plain text, and it creates a virtualenv in a directory outside the skill root (VENV_DIR), which is more intrusive than a simple 'text-correct' utility would normally need.
Instruction Scope
SKILL.md tells the agent to run scripts/correct_text.py which will create a venv, detect GPU, install dependencies, download models, and process inputs. The actual code: (1) will recurse directories and treat .py/.json/.js/.css as text to be 'corrected' (risk of corrupting source/config files), (2) runs nvidia-smi and many pip installs, (3) restarts itself under the created venv. The script also executes side-effectful code at import time (see ensure_package.fix_setuptools_for_legacy_packages) which goes beyond the stated runtime instructions and is unexpected.
Install Mechanism
No install spec in metadata, but the code performs runtime installs: pip installs many packages (pycorrector, kenlm, torch, huggingface-hub, audio-separator, librosa, etc.) and downloads large models via huggingface_hub.snapshot_download and PyTorch wheel URLs. Those are well-known hosts but the skill will perform large network downloads and binary installs automatically. Critically, ensure_package.py calls fix_setuptools_for_legacy_packages() at module import time and runs pip to force-reinstall setuptools in the current interpreter before any venv is created—this is a surprising global change.
Credentials
The skill doesn't request secrets or env vars, which is good. But it writes a virtualenv outside the skill directory (VENV_DIR calculated up the directory tree), modifies the current Python environment (force-reinstall of setuptools on import), writes logs and model files under SKILL_ROOT/models and LOG_DIR, and will download code from external sources. Processing many file types (including code files) is not proportional to the narrow purpose of 'text correction' and could lead to accidental modification of sensitive files if a directory is given.
Persistence & Privilege
always:false (good). However the skill creates persistent artifacts (a venv outside the skill folder, downloaded models, logs, and corrected file outputs) and relaunches itself under the venv. It does not modify other skills' configs, but the ability to install packages and alter the host Python (via setuptools reinstall) gives it high local impact. This persistent, cross-directory behavior is more privilege than expected for a lightweight correction helper.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install llm-text-correct
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /llm-text-correct 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.2.4
- No changes detected in this version; files remain unchanged. - Functionality and behavior are consistent with the previous release.
v1.2.3
- No changes detected in this version; documentation and implementation remain unchanged. - Maintains high-accuracy Chinese text correction through pycorrector and MacBERT models. - Continues support for batch corrections, file/path inputs, and additional refinement via optional parameters. - Keeps compatibility with both python3 and python, with automatic environment setup and GPU detection.
v1.2.2
- Expanded and clarified usage scenarios, adding detailed trigger phrases and supported input types. - Improved documentation: better parameter extraction instructions and explicit trigger conditions. - Clarified model recommendations, now prioritizing MacBERT as default. - Added user-invocable metadata for improved accessibility. - No code changes; documentation and metadata update only.
v1.2.1
- No file changes detected in this version. - No updates or fixes in functionality, documentation, or metadata.
v1.2.0
- Updated the script name in the command line instructions from corrector.py to correct_text.py. - No other content or functional changes.
v1.1.0
- Updated the skill description for clarity and conciseness. - Removed details about custom models and configuration options from the public description. - No changes to functionality or file structure.
v1.0.0
LLM-Text-Correct 1.0.0 - Initial release of the skill. - Supports automatic correction of Chinese text for spelling, character, grammar, and punctuation errors with high accuracy. - Integrates pycorrector with MacBERT and kenlm statistical model; supports custom confusion dictionaries. - Allows specifying models via --model-path, including support for local and Hugging Face-downloaded kenlm models. - Handles correction for direct text input, individual files, or folders, and auto-generates output in parallel location. - Detects GPU automatically and manages Python environment setup/install as needed for execution.
元数据
Slug llm-text-correct
版本 1.2.4
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 7
常见问题

llm-text-correct 是什么?

当用户想要**纠正中文文本错误**、**修改拼写错别字**、**修正语法**、**调整标点**、**润色中文句子**、**检查形近字错误**时自动触发。 使用 pycorrector + MacBERT 专业模型进行高精度中文纠错,准确率远高于普通 LLM 直接提示。 支持直接输入一段文字、长文本,或提供文本文件... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 223 次。

如何安装 llm-text-correct?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install llm-text-correct」即可一键安装,无需额外配置。

llm-text-correct 是免费的吗?

是的,llm-text-correct 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

llm-text-correct 支持哪些平台?

llm-text-correct 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 llm-text-correct?

由 顶尖王牌程序员(@wangminrui2022)开发并维护,当前版本 v1.2.4。

💬 留言讨论