feat: 决策240/241——子级工料机二次合并视野与换码贯通、AdminCost 封存及台账更新

This commit is contained in:
lianjianwei2024
2026-10-30 12:39:32 +08:00
parent b79c0df557
commit 386e1ad624
15 changed files with 15885 additions and 29 deletions

View File

@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
"""批量 OCR:PDF 52-146(第6章),逐页增量落盘,可断点续跑"""
import os, json, sys, time
sys.path.insert(0, r"C:\Users\MZ\AppData\Local\Temp\cos4std")
from ocr_page import ocr_page, BASE
OUT = os.path.join(BASE, "ocr_ch6.json")
START, END = 52, 146
data = {}
if os.path.exists(OUT):
try:
data = json.load(open(OUT, encoding="utf-8"))
print("resume, have", len(data))
except Exception:
data = {}
t0 = time.time()
for n in range(START, END + 1):
key = "p%03d" % n
if key in data and data[key]:
continue
try:
data[key] = ocr_page(n)
print("%s ok items=%d %.0fs" % (key, len(data[key]), time.time() - t0), flush=True)
except Exception as e:
print("%s FAIL %s" % (key, e), flush=True)
data[key] = []
if n % 5 == 0:
json.dump(data, open(OUT, "w", encoding="utf-8"), ensure_ascii=False)
json.dump(data, open(OUT, "w", encoding="utf-8"), ensure_ascii=False)
print("done", len(data), "%.0fs" % (time.time() - t0))