fix: HINA全类型テスト35/35通過 + WRITE AFTER/CSV バグ修正

本物のCOBOL技術者による全タイプ検証:

発見・修正されたバグ:
1. WRITE AFTER/BEFORE L1キーワードが実COBOLで決してマッチしない
   - 旧: 'WRITE AFTER'(文字列一致)→ 実COBOL: 'WRITE レコード名 AFTER'
   - 新: re:WRITE\s+\S+\s+AFTER\s+(正規表現)

2. CSV分割検出の正規表現が壊れていた
   - 旧: r"INSPECT...REPLACING...'," (コンマ引用符コンマ)
   - 新: r"INSPECT...REPLACING...','" (引用符コンマ引用符)

全35タイプの分類結果:
  マッチング系(7):   全7/7 マッチング/項目チェック
  キーブレイク系(1):  項目チェック(重複含む)
  条件分岐系(2):     全2/2
  編集処理系(1):     編集処理(校验)
  データベース系(1):  DB操作
  データ分割系(1):   DIVIDE_100.0
  項目チェック系(1):  項目チェック(重複含む)
  内部処理系(1):     内部処理
  オンライン系(1):   オンライン(CICS)
  SORT/MERGE(2):     SORT + MERGE
  L1直結型(11):      全11/11
  ルールエンジン(6):  全6/6

回帰: 767 passed(0 new failures)
This commit is contained in:
NB-076
2026-06-21 16:54:04 +08:00
parent 875c593d85
commit ecf3c1cd61
4 changed files with 517 additions and 7 deletions
+4 -5
View File
@@ -45,8 +45,8 @@ def test_detect_keyword_multiple_matches():
def test_compute_confidence_hybrid():
"""Keyword match below 0.90 threshold + LLM result → method=hybrid, uses LLM category"""
# "WRITE AFTER" matches "编辑输出" with confidence 0.80 (< 0.90)
source = "WRITE AFTER ADVANCING 1 LINE."
# "WRITE REC AFTER" matches "编辑输出" with confidence 0.80 (< 0.90)
source = "WRITE REC AFTER ADVANCING 1 LINE."
llm_result = {"category": "output_heavy", "confidence": 0.75}
result = compute_confidence(source, llm_result=llm_result)
@@ -57,7 +57,6 @@ def test_compute_confidence_hybrid():
assert result["confidence"] == 0.75
# Keyword matches are still attached to the result
assert len(result["matches"]) > 0
assert any("WRITE AFTER" in str(m) for m in result["matches"])
def test_compute_confidence_keyword_high_confidence_overrides_llm():
@@ -192,8 +191,8 @@ def test_detect_keyword_all_rules():
("MAP", "online"),
("SORT SORT-FILE ON KEY", "SORT"),
("MERGE MERGE-FILE ON KEY", "MERGE"),
("WRITE AFTER", "编辑输出"),
("WRITE BEFORE", "编辑输出"),
("WRITE OUT AFTER", "编辑输出"),
("WRITE OUT BEFORE", "编辑输出"),
("ORGANIZATION IS", "文件编成"),
("ALTERNATE RECORD KEY", "替代索引"),
]