Tooluck logoTooluck
SKILL.md

word-analysis

Agent skill fromOpenSenseNova/SenseNova-Skills

Word (.docx/.doc) 文档全量解析。覆盖:正文/段落文本提取、表格数据提取、高亮/颜色格式读取、多文件汇总对比、嵌入图片转 caption。

How to install word-analysis

install word-analysis
# install the SenseNova-Skills pack with the skills CLI
npx skills add OpenSenseNova/SenseNova-Skills

# or add only this skill to Claude Code: copy the folder

skills/sn-da-non-spreadsheet-analysis/capability/word-analysis/

# into

~/.claude/skills/word-analysis/ (all projects)

.claude/skills/word-analysis/ (one project)

skills/sn-da-non-spreadsheet-analysis/capability/word-analysis/SKILL.md

MITFull file
1# Word Analysis — .docx / .doc
2
3## Environment
4
5```python
6from docx import Document
7import os
8
9# python-docx is available; for .doc (old format) convert via libreoffice first
10def load_doc(path):
11 """Load .docx directly; convert .doc to .docx first if needed."""
12 if path.lower().endswith('.doc'):
13 import subprocess
14 out_dir = os.path.dirname(path)
15 subprocess.run(
16 ['libreoffice', '--headless', '--convert-to', 'docx', '--outdir', out_dir, path],
17 check=True, capture_output=True
18 )
19 path = path.rsplit('.', 1)[0] + '.docx'
20 return Document(path)
21```
22
23---
24
25## Core Method 1: Full Text Extraction
26
27```python
28def extract_full_text(doc_path):
29 """Extract all text: paragraphs + table cells, in document order."""
30 doc = load_doc(doc_path)
31 lines = []
32
33 # Iterate paragraphs and tables in body order
34 from docx.oxml.ns import qn
35 for block in doc.element.body:
36 tag = block.tag.split('}')[-1]
37 if tag == 'p':
38 # Paragraph
39 from docx.text.paragraph import Paragraph
40 para = Paragraph(block, doc)
41 text = para.text.strip()
42 if text:
43 lines.append(text)
44 elif tag == 'tbl':
45 # Table
46 from docx.table import Table
47 tbl = Table(block, doc)
48 for row in tbl.rows:
49 row_text = '\t'.join(cell.text.strip() for cell in row.cells)
50 if row_text.strip():
51…

Excerpt shown under the repository's MIT license.

More skills in SenseNova-Skills

Keep exploring

Similar skill repositories

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates