idle / scratch /check_cycle.py
Lashtw's picture
Upload 1992 files
4bba76c verified
Raw History Blame Contribute Delete
953 Bytes
import json
import os
import sys
sys.stdout.reconfigure(encoding='utf-8')
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def check_round_pages(part):
folder = os.path.join(ROOT, 'scratch', 'ocr', part)
pages = []
for p in range(1, 105):
path = os.path.join(folder, f'p{p:03d}.json')
if not os.path.exists(path):
continue
with open(path, 'r', encoding='utf-8') as f:
items = json.load(f)
texts = [it['text'] for it in items]
full_text = " ".join(texts)
has_round = False
nums = []
for it in items:
t = it['text'].strip()
if len(t) == 3 and t.isdigit():
nums.append(int(t))
pages.append((p, nums, texts[:2]))
print(f"--- Part {part} Summary ---")
for p, nums, top in pages:
if nums:
print(f"p{p:03d}: nums={nums} | top={top}")
check_round_pages('A')