v13-f1 Task 1.8: relationForm 0 误差 (P0 两阶段, 前端代码反推)
This commit is contained in:
1 parent
405327d11e
commit
4b29146696
6 files changed
+360
No files matched your search
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
"""从 35 form baseline 提取所有 relationForm 控件的 formData 真实样本.
|
||||
relationForm 控件判定: __config__.jnpfKey == 'relationForm'."""
|
||||
import json, glob, os
|
||||
|
||||
OUT = "scripts/relationForm-baseline-samples.jsonl"
|
||||
samples = []
|
||||
for path in glob.glob("/home/ubuntu/ccWorkDir/baseline/*/form/*.json"):
|
||||
try:
|
||||
d = json.load(open(path))['data']
|
||||
fd = json.loads(d['formData']) if isinstance(d.get('formData'), str) else {}
|
||||
for f in fd.get('fields', []):
|
||||
if isinstance(f, dict):
|
||||
cfg = f.get('__config__', {})
|
||||
if isinstance(cfg, dict) and cfg.get('jnpfKey') == 'relationForm':
|
||||
samples.append({
|
||||
"source": os.path.basename(path),
|
||||
"label": f.get('label') or cfg.get('label'),
|
||||
"formData": f
|
||||
})
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
with open(OUT, 'w') as out:
|
||||
for s in samples:
|
||||
out.write(json.dumps(s, ensure_ascii=False) + "\n")
|
||||
|
||||
print(f"Extracted {len(samples)} relationForm 控件 samples to {OUT}")
|
||||
Reference in new issue
Block a user