name: office-helper-zx displayName: 辦公效率工具箱 version: 2.0.0 summary: 10個高階演算法辦公工具:TF-IDF檔案分類/PDF結構分析/三重文件相似度/智慧批次重新命名/Excel多表合併/會議紀要解析/區間樹排班衝突/Myers文本差異/MD5檔案查重/TextRank文件摘要 tags: [office, productivity, tfidf, textrank, myers-diff, interval-tree, automation] license: MIT
office-helper 是一套包含10個高階演算法驅動的辦公自動化工具的 Python 技能包。所有功能僅使用Python標準庫實現,無需安裝任何外部依賴。涵蓋檔案分類、PDF分析、文件對比、批次重新命名、Excel合併、會議解析、排班檢測、文本差異、檔案查重、文件摘要等場景。
| # | 函式名 | 演算法原理 | 複雜度 |
|---|---|---|---|
| 1 | smart_file_classifier |
TF-IDF向量空間模型 + 餘弦相似度 + K-Means++聚類 | O(n^2 * m) |
| 2 | pdf_structure_analyzer |
PDF二進位制解析 + zlib解壓 + 正則提取 | O(n) |
| 3 | document_similarity_compare |
Jaccard + TF-IDF餘弦 + Levenshtein編輯距離 | O(nm + |s1||s2|) |
| 4 | batch_rename_with_pattern |
正則匹配 + 序號填充 + 日期格式化 + 變數替換 | O(n) |
| 5 | excel_data_merger |
XLSX解析 + LEFT/RIGHT/OUTER/INNER JOIN | O(n+m) |
| 6 | meeting_minutes_parser |
正則引擎 + 規則引擎 + NLP提取 | O(n) |
| 7 | schedule_conflict_detector |
AVL平衡區間樹 + 區間重疊檢測 | O(n log n + k) |
| 8 | text_diff_analyzer |
Myers差異演算法(LCS動態規劃) | O(n*m) |
| 9 | file_duplicate_finder |
MD5雜湊 + 檔案大小過濾 + 檔名相似度 | O(n) + O(n^2) |
| 10 | document_summary_generator |
TextRank圖排序(PageRank迭代) | O(n^2 * T) |
無需安裝額外依賴,僅使用Python標準庫(hashlib, re, os, json, collections, math, difflib, zipfile, zlib等)。
from main import smart_file_classifier, document_similarity_compare, text_diff_analyzer
# TF-IDF智慧檔案分類
result = smart_file_classifier("/path/to/files")
print(result["clusters"])
# 三重演算法文件相似度對比
sim = document_similarity_compare("doc1.txt", "doc2.txt")
print(f"Jaccard: {sim['jaccard']:.3f}, Cosine: {sim['cosine']:.3f}")
# Myers文本差異
diff = text_diff_analyzer("text1.txt", "text2.txt")
for line in diff["diff"]:
print(f"{line['type']}: {line['content']}")
無外部依賴(僅使用Python標準庫)
小蔥技能7w4.net有完整的技能分類。
MIT
這個工具箱質量不錯,提供了10個實用的辦公自動化功能,從檔案分類到文件摘要都能覆蓋。程式碼實現乾淨利落,文件說明清晰易懂。但有一點需要注意:它說不需要安裝額外軟體包,實際上配置檔案裡列了好幾個依賴項,容易讓人搞不清楚到底要不要裝東西。另外一些高階功能在大檔案場景下可能不夠穩定。適合對演算法原理感興趣或需要輕量級工具的使用者使用。