Spaces:
Running on Zero
Running on Zero
Download tools/build_bundle.py from Bigbearbo/word-problem-reader: direct link, hf CLI and curl.
- Browser
- Download file 2.49 kB
-
https://huggingface.co/spaces/Bigbearbo/word-problem-reader/resolve/main/tools/build_bundle.py
- Command line
-
hf download hf://spaces/Bigbearbo/word-problem-reader/tools/build_bundle.py
-
curl -L -o build_bundle.py https://huggingface.co/spaces/Bigbearbo/word-problem-reader/resolve/main/tools/build_bundle.py
2.49 kB
| # -*- coding: utf-8 -*- | |
| """Copy the latest program brain / parser / v7 reader prompt and the files they read into hs/ (mirror of 手搓算術). | |
| Only the files the one-read pipeline touches (traced 2026-11-27); tests and result files are left out. | |
| python -B tools/build_bundle.py | |
| """ | |
| import shutil | |
| from pathlib import Path | |
| SRC = Path(r"H:\Agent共用\專案\手搓算術") | |
| DST = Path(__file__).resolve().parent.parent / "hs" | |
| INFO = ["程式腦.py", "解析.py", "讀題_LLM.py", "讀題_提示v7.py", "v7守門.py", "探索模式.py", | |
| "讀法修補.py", "回饋修正.py"] # #350 reading repair + v1 feedback correction | |
| TREE = ["engine.py", "樹.json", "詞庫.json", "資訊句輸出.py"] # 資訊句輸出.py = rule-tree reader (program layer) | |
| SUB = ["單位", "比較", "移轉", "輸出格式", "速率", "部分與整體"] # 語法模組 sub-modules: *.py (no tests) + 關係卡/補充表 | |
| KB = ["基礎詞.json", "換算.json", "規則登記.json"] | |
| MIXF = ["句法讀題/構式讀題.py", "句法讀題/構式逐句混合.py", "句法讀題/取代守門.py", "句法讀題/解壓.py", # #348 逐句混合 | |
| "吸收讀題/吸收.py", "讀法收割/收割.py", "語形/還原.py", "語形/語形表.json"] | |
| def cp(rel): | |
| s, d = SRC / rel, DST / rel | |
| d.parent.mkdir(parents=True, exist_ok=True) | |
| shutil.copy2(s, d) | |
| return d.stat().st_size | |
| def main(): | |
| if DST.exists(): | |
| shutil.rmtree(DST) | |
| n = 0 | |
| for f in INFO: | |
| n += cp(Path("語法模組/資訊句") / f) | |
| for f in ("核心.py", "api.py"): | |
| n += cp(Path("語法模組") / f) | |
| for sub in SUB: | |
| for p in (SRC / "語法模組" / sub).rglob("*"): | |
| if "__pycache__" in p.parts or not p.is_file(): | |
| continue | |
| if p.suffix == ".py" and "測試" not in p.name: | |
| n += cp(p.relative_to(SRC)) | |
| elif p.name in ("關係卡.json", "補充表.json"): | |
| n += cp(p.relative_to(SRC)) | |
| for f in KB: | |
| n += cp(Path("語法模組/知識庫") / f) | |
| for f in MIXF: | |
| n += cp(Path("語法模組") / f) | |
| for f in TREE: | |
| n += cp(Path("規則樹") / f) | |
| for p in (SRC / "規則樹" / "葉子").rglob("*.json"): | |
| n += cp(p.relative_to(SRC)) | |
| n += cp(Path("轉換庫/轉換表.json")) | |
| print(f"copied {sum(1 for _ in DST.rglob('*') if _.is_file())} files, {n:,} bytes -> {DST}") | |
| if __name__ == "__main__": | |
| main() | |