feat: Phase 2 complete — 13 Phases of COBOL type classification and test benchmark
P0.6: gcov infrastructure P1: extract_structure output expansion (11 new feature fields) P2: Confusion group rule engine (8 pairs + contradiction + backtrack) P3: 4-factor confidence calculation + quality gate update P4: 33+2 COBOL program type test samples (22 files, 7 categories) P5: parametrized/ test data generation engine P6: japanese_data.py lookup tables P7-10: Type-specific test suites (~159 parametrized tests) P11: Full classification pipeline (classify_program) + orchestrator integration P12: Documentation (module-interfaces, test-plan v3.0, coverage-matrix) Architecture decisions: - classification_pipeline/ merged to hina/pipeline/ - parametrized/ as independent module - japanese_data.py as root-level file - hina/__all__ only exports classify_program() Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import json, os, sys
|
||||
sys.path.insert(0, ".")
|
||||
os.environ["LLM_API_KEY"] = "sk-ca4961087c7f4aefa8ed0fc6f3d02329"
|
||||
os.environ["LLM_API_BASE"] = "https://api.deepseek.com/v1"
|
||||
|
||||
from config import Config
|
||||
from orchestrator import run_pipeline
|
||||
|
||||
cfg = Config()
|
||||
cfg.llm_model = "deepseek-chat"
|
||||
cfg.runner_mode = "native"
|
||||
|
||||
task_id = sys.argv[1] if len(sys.argv) > 1 else "ec17bf32"
|
||||
tf = f"tasks/{task_id}.json"
|
||||
data = json.load(open(tf))
|
||||
|
||||
vr = run_pipeline(cfg, f"uploads/{task_id}/copybook.cpy", f"uploads/{task_id}/program.cbl",
|
||||
f"uploads/{task_id}/java", f"uploads/{task_id}/mapping.yaml")
|
||||
|
||||
fields = [{"name":fr.field_name,"status":fr.status,
|
||||
"cobol":str(fr.cobol_value),"java":str(fr.java_value),
|
||||
"suggestion":fr.suggestion} for fr in vr.field_results]
|
||||
|
||||
debug = vr.debug
|
||||
if "field_tree" in debug:
|
||||
debug["field_tree"] = [{"name":f["name"],"level":f["level"],"pic":f["pic"],
|
||||
"usage":f["usage"],"offset":f["offset"],"length":f["length"]} for f in debug["field_tree"]]
|
||||
if "test_cases" in debug:
|
||||
debug["test_cases"] = [{"id":tc["id"],"fields":tc["fields"],
|
||||
"targets":tc.get("targets",[])} for tc in debug["test_cases"]]
|
||||
for k in ("cobol_build","java_build"):
|
||||
if k in debug and debug[k]:
|
||||
debug[k]["log"] = debug[k].get("log","")[-500:]
|
||||
|
||||
data["status"] = "done"
|
||||
data["fields"] = fields
|
||||
data["debug"] = debug
|
||||
data["result"] = {
|
||||
"program": vr.program, "status": vr.status,
|
||||
"matched": vr.fields_matched, "mismatched": vr.fields_mismatched,
|
||||
"duration": round(vr.duration_s, 1), "runner": vr.runner,
|
||||
}
|
||||
json.dump(data, open(tf, "w"))
|
||||
print("Task updated!")
|
||||
print(f"Status: {vr.status}, Matched: {vr.fields_matched}, Mismatched: {vr.fields_mismatched}")
|
||||
for fr in vr.field_results:
|
||||
print(f" {fr.field_name}: {fr.status} (COBOL={fr.cobol_value}, Java={fr.java_value})")
|
||||
Reference in New Issue
Block a user