light-file-reading

Solid

强大地读文件并学习——Word、PDF、PPTX、Excel、CSV、图片、视频、代码、压缩包等。当用户提供任何文件、问"这个文件讲了什么"、或任务需要理解已有材料时使用(常驻,自动触发)。不只提取文字,而是理解结构、逻辑、图表、数据、实验结果、格式要求、章节关系、视觉风格、隐含要求与可复用内容,并转化为可执行任务。

Data & Documents 77 stars 17 forks Updated today MIT

Install

View on GitHub

Quality Score: 88/100

Stars 20%
63
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# 多格式文件深度理解 ## 触发 任何涉及已有文件的任务自动启用,无需显式调用。 ## 即用脚本(scripts/,均带自检,可直接 python 运行) - **`scripts/pdf_ops.py`**:`read_meta` / `extract_text(layout)` / `extract_tables`→DataFrame(pdfplumber),`merge` / `split` / `rotate`(pypdf)。`python pdf_ops.py` 跑合成自检。 - **`scripts/docx_read.py`**:`read_paragraphs` / `read_headings`(章节骨架)/ `read_runs`(样式提取)/ `read_tables` / `read_layout`(页边距纸张)。python-docx,**不读修订**。 - **`scripts/xlsx_read.py`**:`list_sheets` / `read_formulas`(不求值)/ `read_values`(缓存)/ `profile`(pandas 数据画像)。openpyxl **无求值引擎**,算值需 LibreOffice 重算。 逐格式完整 copy-paste 代码块见 `references/`(PDF-REF / DOCX-REF / XLSX-REF / PPTX-REF,渐进式按需读)。 ## 按格式选工具(见 a09,细节见 references.md) - **PDF**:机器生成 PDF 用 `pdfplumber` 抽文本(`extract_text(layout=True)`)与表格(`extract_tables`→DataFrame,策略 lines/text,调 snap_tolerance);结构操作(合并/拆分/旋转/加密/书签)用 `pypdf`;扫描件 OCR 走 `pytesseract+pdf2image`;快速归一为 md 用 `markitdown file.pdf -o out.md`。论文 PDF 关注章节/图表/表格定位,可用 `page.crop(bbox)` 锁区域。pdfplumber/pypdf 均无 OCR、不读纯图。 - **Word(.docx)**:读用 `pandoc in.docx -o out.md`(带 `--track-changes=all` 把增删/批注包成 insertion/deletion/comment span 保留作者+时间、`--extract-media=./media` 导图、引文 `--citeproc --bibliography refs.bib --csl apa.csl`)或 `python-docx` 遍历 paragraphs→runs 读样式/题注;提取模板格式要求(页边距/字号/编号/引用风格)。需精确改原文/redline 时走「解包→直接改 XML→重打包」:插入 `<w:ins w:author=.. w:date=..>`、删除 `<w:del>` 内用 `<w:delText>`,最小化只标真正变动的词。注意 python-docx 不读修订、无渲染;pandoc AST 不保页边距等精确格式。 - **PPTX**:读用 `python -m markitdown deck.pptx` 抽文本,再渲染成图(`soffice --headless --convert-to p...

Details

Author
Light0305
Repository
Light0305/Light-skills
Created
5 days ago
Last Updated
today
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category