dsh-skill-pdf-math
其他 活跃维护

dsh-skill-pdf-math

zzjj66/dsh-skill-pdf-math

直接解析PDF中的数学公式与表达式,提供提取、转换和计算能力,轻量集成便于自动化调用,适合需要从文档中获取数学内容的场景,操作简洁不需复杂配置。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
Python
主要语言
MIT
开源协议
15 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:zzjj66/dsh-skill-pdf-math
git clone https://github.com/zzjj66/dsh-skill-pdf-math.git
git clone git@github.com:zzjj66/dsh-skill-pdf-math.git
README.md main

dsh-skill-pdf-math

A DeepSeek Harness skill for reading
mathematics out of PDFs and formula screenshots without guessing.

Why

Vision models misread formulas in predictable ways: a \mathcal{L} becomes \angle,
a summation subscript j=1 becomes \cdot, a tall bracket turns into [[[.
Most of that is unnecessary, because a LaTeX-produced PDF stores formulas as
positioned text, not images — glyphs, baselines, sizes and font names are all there.

So the skill teaches one rule:

read the text layer first, let formula OCR supply the structure, and cross-check the two.

What it adds

  • pdf_formula.py — turns a PDF region into readable (approximate) LaTeX by restoring
    sub/superscripts from baseline offsets, plus a small TeX cmex10 operator table.
  • --probe — decides whether a page's formulas are extractable text or images.
  • --crosscheck — compares the OCR result against the text layer's letters and their fonts
    (cmsy10's L is \mathcal{L}), so a wrong glyph is named instead of merely suspected.
  • --verify — re-recognises with a different crop and resolution; disagreement is reported.

Measured on four numbered equations from a real paper:

render mean similarity exact
400 dpi 0.941 2/4
600 dpi 0.977 3/4

--check requires the optional rapid_latex_ocr runtime; without it the text-layer
channel still works and the skill says so instead of failing.

Install

dsh plugin --profile <name> add dsh-skill-pdf-math

or install it from the DSH plugin marketplace. The skill registers itself as
pdf-math and is model-invocable.

Notes

  • Registration is wrapped in a try/catch: a broken asset can disable the skill,
    never the host application.
  • Paths are injected at run time, so the published package contains no machine-specific paths.

License

MIT