Download scripts/_scan_eqrefs.py from m-rui001/physics-typst-corpus: direct link, hf CLI and curl.
- Browser
- Download file 370 Bytes
-
https://huggingface.co/datasets/m-rui001/physics-typst-corpus/resolve/main/scripts/_scan_eqrefs.py
- Command line
-
hf download hf://datasets/m-rui001/physics-typst-corpus/scripts/_scan_eqrefs.py
-
curl -L -o _scan_eqrefs.py https://huggingface.co/datasets/m-rui001/physics-typst-corpus/resolve/main/scripts/_scan_eqrefs.py
370 Bytes
| import re | |
| p = 'papers/2308.08546/main.typ' | |
| s = open(p, encoding='utf-8').read() | |
| keys = {} | |
| for m in re.finditer(r'<eq:[^<>]+>', s): | |
| key = m.group(0) | |
| before = s[max(0, m.start() - 8):m.start()] | |
| attached = before.rstrip().endswith('$') | |
| keys.setdefault(key, []).append(attached) | |
| for k, v in keys.items(): | |
| print(k, 'total', len(v), 'attached', sum(v)) | |