AI Humanizer CN v5.1.0
版本: 5.1.0
更新日期: 2026-03-23
作者: pengong101
许可: MIT
🆕 v5.1.0 新增功能
1. 拟人化强度控制
新增参数: --intensity 或 intensity
支持级别:
low- 低强度(5-10% 口语化,适合技术文档)medium- 中强度(15-20% 口语化,适合科普文章)⭐ 默认high- 高强度(25-35% 口语化,适合社交媒体)auto- 自适应(根据 QC 评分自动调整)⭐ v5.1.0 新增
自适应模式(auto):
# 根据 QC 评分自动调整拟人化强度
qc_score = 8.5 # QC 评分
if qc_score >= 9.0:
intensity = "low" # 高质量文章,最小改动
elif qc_score >= 8.0:
intensity = "medium" # 良好文章,适度优化
elif qc_score >= 7.0:
intensity = "high" # 中等文章,明显改进
else:
intensity = "high" # 低质量文章,大幅修改
使用示例:
# 命令行
humanizer-cn --input input.txt --intensity medium
humanizer-cn --input input.txt --intensity auto # 自适应
# Python
h = Humanizer(intensity="medium")
h = Humanizer(intensity="auto", qc_score=8.5) # 自适应
2. 反问句密度控制
自动限制: 每 500 字≤3 个反问句
配置选项:
{
"rhetorical_question_density": 3, // 每 500 字最大反问句数
"rhetorical_question_check": true // 启用检查
}
3. 文章类型感知
支持的类型:
tech- 技术文章(减少情感词汇,保持严谨)science- 科普文章(平衡专业性与可读性)⭐ 推荐social- 社交媒体(增加情感表达和互动)academic- 学术论文(最小拟人化)
自动适配:
# 根据类型自动调整参数
h = Humanizer(article_type="science")
# 自动设置:intensity="medium", protect_terms=True
4. 专业性保护开关
新增参数: --protect-terms 或 protect_terms=True
保护内容:
- ✅ 核心数据(数字、百分比、统计)
- ✅ 专业术语(科技术语、人名、地名)
- ✅ 引用内容(专家引语、文献引用)
- ✅ 时间信息(日期、年份)
使用示例:
humanizer-cn --input input.txt --protect-terms true
🎯 核心功能
1. 多模型支持
支持的 AI 模型:
- ✅ OpenAI (GPT-4/GPT-3.5)
- ✅ Anthropic (Claude-3)
- ✅ 阿里百炼 (Qwen-Max/Qwen-Plus)
- ✅ MiniMax (ABAB 系列)
模型选择:
# 环境变量设置
export HUMANIZER_MODEL="openai/gpt-4"
# 或
export HUMANIZER_MODEL="anthropic/claude-3"
# 或
export HUMANIZER_MODEL="dashscope/qwen-max"
2. 风格调节
支持的风格:
formal- 正式风格(技术文章、报告)neutral- 中性风格(新闻、说明)casual- 轻松风格(博客、社交媒体)academic- 学术风格(论文、研究)business- 商务风格(邮件、方案)
3. 批量处理
支持的批量操作:
- 文件夹批量处理
- 多格式混合(.md/.txt/.py/.js)
- 并行处理(多线程)
- 进度条显示
4. 代码优化
支持的编程语言:
- Python 代码注释优化
- JavaScript 代码注释优化
- SQL 查询语句优化
- Shell 脚本优化
💻 使用方式
方式 1:命令行调用
# 基础使用
humanizer-cn --input input.txt --output output.txt
# 指定风格
humanizer-cn --input input.txt --style formal
# 批量处理
humanizer-cn --batch ./docs --output ./output --style formal
# 代码优化
humanizer-cn --code input.py --output output.py
# 指定模型
humanizer-cn --input input.txt --model anthropic/claude-3
方式 2:Python 调用
from ai_humanizer import Humanizer
# 初始化
h = Humanizer(
model="openai/gpt-4",
style="formal",
api_key="your_api_key"
)
# 优化文本
text = "本文旨在探讨..."
optimized = h.humanize(text)
print(optimized)
# 批量处理
results = h.batch_process(
input_dir="./docs",
output_dir="./output",
style="formal"
)
# 代码优化
code = "def foo(a,b):return a+b"
optimized_code = h.optimize_code(code, language="python")
print(optimized_code)
方式 3:OpenClaw 技能调用
from skills.ai_humanizer_cn import humanize
result = humanize("AI 生成的文本", style="formal")
⚙️ 配置选项
环境变量
# API 密钥(至少配置一个)
export OPENAI_API_KEY="sk-xxx"
export ANTHROPIC_API_KEY="sk-ant-xxx"
export DASHSCOPE_API_KEY="sk-xxx"
# 默认模型
export HUMANIZER_MODEL="openai/gpt-4"
# 默认风格
export HUMANIZER_STYLE="formal"
# 批处理线程数
export HUMANIZER_THREADS="4"
# 日志级别
export HUMANIZER_LOG_LEVEL="INFO"
配置文件
位置: ~/.ai-humanizer/config.json
{
"model": "openai/gpt-4",
"style": "formal",
"intensity": "medium",
"article_type": "science",
"protect_terms": true,
"max_length": 2000,
"temperature": 0.7,
"batch_size": 10,
"threads": 4,
"output_format": "text",
"rhetorical_question_density": 3
}
📊 性能指标
| 指标 | 数值 |
|---|---|
| 优化准确率 | 95%+ |
| 处理速度 | <500ms/千字 |
| 支持语言 | 中文、英文 |
| 批量处理 | 支持 1000+ 文件 |
| 并发处理 | 支持 10 线程 |
| 模型支持 | 4 家提供商 |
🧪 测试
运行测试
# 安装测试依赖
pip install pytest pytest-cov
# 运行测试
pytest tests/ -v --cov=ai_humanizer
# 查看覆盖率
coverage html
测试覆盖
Name Stmts Miss Cover
-------------------------------------------
ai_humanizer.py 250 25 90%
humanize_v5.py 180 18 90%
tests/test_humanizer.py 150 0 100%
-------------------------------------------
TOTAL 580 43 93%
📦 文件结构
ai-humanizer-cn/
├── SKILL.md # 技能文档(本文件)
├── README.md # 详细说明
├── LICENSE # MIT 许可证
├── clawhub.json # ClawHub 配置
├── requirements.txt # Python 依赖
├── setup.py # 安装脚本
├── ai_humanizer.py # 主程序(v5.0.0)
├── humanize_v5.py # v5.0.0 核心
├── humanize_v4.py # v4.0.0(兼容)
├── humanize_v3.py # v3.0.0(兼容)
├── config.py # 配置管理
├── utils.py # 工具函数
├── tests/ # 测试目录
│ ├── test_humanizer.py
│ └── fixtures/
├── examples/ # 示例目录
│ ├── basic_usage.py
│ └── batch_processing.py
└── docs/ # 文档目录
├── installation.md
├── usage.md
└── api.md
🔧 安装
方式 1:pip 安装
pip install ai-humanizer-cn
方式 2:源码安装
git clone https://github.com/pengong101/ai-humanizer-cn
cd ai-humanizer-cn
pip install -e .
方式 3:ClawHub 安装
openclaw skills install ai-humanizer-cn
📊 版本历史
| 版本 | 日期 | 主要更新 |
|---|---|---|
| v5.1.0 | 2026-03-23 | 拟人化强度控制/反问句密度控制/文章类型感知/专业性保护 ⭐ |
| v5.0.0 | 2026-03-18 | 多模型支持/批量处理/代码优化/测试覆盖 |
| v4.0.0 | 2026-03-18 | 代码优化/表格格式化/PPT 大纲 |
| v3.1.0 | 2026-03-17 | 8 维风格向量/多语言支持 |
| v3.0.0 | 2026-03-14 | 7 种写作风格/语境感知 |
| v2.1.0 | 2026-03-13 | 批量处理/性能优化 |
| v2.0.0 | 2026-03-12 | 架构重构/风格调节 |
| v1.1.0 | 2026-03-11 | 性能优化 |
| v1.0.0 | 2026-03-11 | 初始版本 |
🔗 相关链接
- GitHub: https://github.com/pengong101/ai-humanizer-cn
- PyPI: https://pypi.org/project/ai-humanizer-cn/
- ClawHub: 待发布
- 文档: https://ai-humanizer-cn.readthedocs.io/
- 作者: pengong101
📝 常见问题
Q: 需要 API 密钥吗?
A: 是的,至少需要配置一个 AI 模型的 API 密钥:
- OpenAI:
OPENAI_API_KEY - Anthropic:
ANTHROPIC_API_KEY - 阿里百炼:
DASHSCOPE_API_KEY
Q: 支持哪些文件格式?
A: 支持:
- 文本:.txt, .md
- 代码:.py, .js, .sql, .sh
- 批量:文件夹递归处理
Q: 批量处理速度如何?
A: 默认 4 线程并行,每秒可处理 10-20 个文件(取决于文本长度)。
最后更新: 2026-03-18
版本: 5.0.0 (Latest)
许可: MIT License
测试覆盖: 93%