import json, collections, re p='.scratch/cockpit-real-data-wayfinding/verify/artifacts/t67/geom-none.json' d=json.load(open(p,encoding='utf-8')) feats=d['data']['features'] def pref(code): m=re.match(r'^([A-Za-z]{2})', str(code or '')) return m.group(1) if m else '(none)' # 前缀 × name 里出现的片区词 tab=collections.defaultdict(collections.Counter) for ft in feats: pr=ft.get('properties') or {} name=str(pr.get('name') or '') words=tuple(w for w in ['城南','城北','太常'] if w in name) tab[pref(pr.get('code'))][words]+=1 for k in sorted(tab): print('prefix', k, dict(tab[k])) print() # 非 TC/CN 的样本 for ft in feats: pr=ft.get('properties') or {} if pref(pr.get('code')) in ('GD','YL'): print('ODD', json.dumps({kk:pr.get(kk) for kk in ('source','code','name','industry','typeCode','pointType','remark')}, ensure_ascii=False)) print() # 第二段:行业字母(第 3-4 位)分布,验证"片区+行业+时间" ind=collections.Counter() for ft in feats: pr=ft.get('properties') or {} code=str(pr.get('code') or '') if len(code)>=4: ind[(pref(code), code[2:4])]+=1 print('prefix+biz code:', dict(ind))