research(jev-intent): 修复轮重造语料并全量对照
来源 C 改为 DeepSeek Flash 生成+独立复核,撤回模板拼接结论。来源 B 157 条人工标注后跑 Jev x2 与 Flash 全量对照,结论为缺数据。
This commit is contained in:
@@ -6,7 +6,12 @@ import json
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import inspect
|
||||
|
||||
from scripts.research.jev_intent_corpus_build import ( # noqa: E402
|
||||
GENERATOR_NAME,
|
||||
REVIEWER_NAME,
|
||||
build_review_prompt,
|
||||
holdout_name_denylist,
|
||||
review_sample,
|
||||
source_a_samples,
|
||||
@@ -82,10 +87,30 @@ class JevIntentCorpusTests(unittest.TestCase):
|
||||
"user_message": "没有",
|
||||
"focus": {"current_question": "钱的方面,还记得哪年收入明显变过吗?", "options": []},
|
||||
"gold": {"intent": "stop_rectification", "answer_class": None, "has_new_dated_event": False},
|
||||
"target_before_review": {"intent": "stop_rectification"},
|
||||
}
|
||||
reviewed = review_sample(sample)
|
||||
self.assertEqual(reviewed["intent"], "answer_current_focus")
|
||||
self.assertEqual(reviewed["answer_class"], "no")
|
||||
prompt = build_review_prompt(sample)
|
||||
self.assertIn("没有", prompt)
|
||||
self.assertIn("钱的方面,还记得哪年收入明显变过吗?", prompt)
|
||||
self.assertNotIn("目标", prompt)
|
||||
tail = prompt.rsplit("用户回复:", 1)[-1]
|
||||
self.assertIn("没有", tail)
|
||||
self.assertNotIn("stop_rectification", tail)
|
||||
self.assertNotIn("template", GENERATOR_NAME.lower())
|
||||
self.assertNotIn("rule", REVIEWER_NAME.lower())
|
||||
|
||||
def test_corpus_build_has_no_literal_word_bank(self) -> None:
|
||||
src = (ROOT / "scripts" / "research" / "jev_intent_corpus_build.py").read_text(encoding="utf-8")
|
||||
self.assertNotIn("bank = {", src)
|
||||
self.assertNotIn('GENERATOR_NAME = "agent-template', src)
|
||||
self.assertNotIn('REVIEWER_NAME = "agent-rule', src)
|
||||
|
||||
def test_reviewer_does_not_regex_label(self) -> None:
|
||||
src = inspect.getsource(review_sample)
|
||||
self.assertNotIn("re.search", src)
|
||||
self.assertNotIn("re.match", src)
|
||||
self.assertNotIn("STOP_RE", src)
|
||||
self.assertIn("complete_chat", src)
|
||||
|
||||
def test_current_instructions_match_production_classifier(self) -> None:
|
||||
from scripts.research.jev_intent_current import CHOICE_INSTRUCTIONS, COLLECT_INSTRUCTIONS
|
||||
|
||||
Reference in New Issue
Block a user