Install
openclaw skills install docx-compareCompare two Word documents (DOCX) to find duplicate text paragraphs and duplicate images. Supports exact string matching, fuzzy matching (difflib), and image...
openclaw skills install docx-compare比较两个 Word 文档(.docx),找出重复的文本段落和重复的图片。
# 最基本用法:比较两个 docx
python scripts/compare_docx.py --file1 文档A.docx --file2 文档B.docx
# 指定输出目录
python scripts/compare_docx.py --file1 文档A.docx --file2 文档B.docx --output ./对比结果
| 模式 | 说明 | 阈值 |
|---|---|---|
| 精确匹配 | 标准化后完全相同的段落 | 100% |
| 模糊匹配 | 相似度超过阈值的段落 | ≥95% |
| 图片查重 | 通过 MD5 哈希值比较图片 | 100% |
*_标记重复.docx — 高亮标记了重复文字的原始文档*_标记图片重复.docx — 标注了重复图片的原始文档*_重复报告.txt — 纯文本详细对比报告python scripts/compare_docx.py \
--file1 <路径> # 必需:第一个文档
--file2 <路径> # 必需:第二个文档
--output <目录> # 可选:输出目录(默认同目录)
--mode all|text|image # 可选:检查模式(默认 all)
--threshold 0.95 # 可选:模糊匹配相似度阈值(默认 0.95)
python-docx 用于读写 DOCX 文件difflib(标准库)用于模糊匹配hashlib(标准库)用于图片 MD5 计算安装依赖:
pip install python-docx
.docx 格式,不支持旧版 .doc(需要先转换)difflib.SequenceMatcher,CPU 开销随段落数平方增长word-docx — 通用 Word 文档创建、编辑、格式调整clawhub star docx-compareclawhub sync