# -*- coding: utf-8 -*-
import io, sys, os, json, re
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
B = r"D:\work buddy\2026-11-05-14-15-52"
c = json.load(open(os.path.join(B,"pending_ucsd_catd.json"),encoding="utf-8")) if os.path.exists(os.path.join(B,"pending_ucsd_catd.json")) else None
if c is None:
    # dry-run 未生成 pending，直接从 raw 套用
    print("pending 未生成，先 --write")
else:
    # 名称残留学位 token 检查
    tok=re.compile(r",?\s*(PhD|MS|MEng|MA|MFA|MPH|MPP|MAS|MPS|MBA|MD|AuD|EdD|MIA|MURP|MQF|MPAc|MDes|MDS)\s*$",re.I)
    bad=[x for x in c if tok.search(x[2])]
    print("名称残留学位:", len(bad))
    for x in bad: print("  ", x[2])
    print("--- biz/med/edu ---")
    for x in c:
        if x[6] in ("biz","med","edu"): print(f"{x[6]:4}|{x[4]:5}|{x[1][:18]:18}|{x[2][:46]}")
