Claude Claude Opus 5.5 commited on
ตัวตีความ: "ไม่ใช่" / "ไม่ใช่ครับ" กฎอ่านเป็นปฏิเสธ ไม่ต้องเรียก LLM
Browse fileslat2 (26 ต.ค.): "ไม่ใช่" มีคำว่า "ใช่" ข้างใน → กฎนับว่าทั้งรับและปฏิเสธ → ส่ง LLM (+2.1 วิ)
ตัดคำปฏิเสธ (และหางเสียงเมื่อมีคำปฏิเสธ) ออกก่อนหาคำรับ
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Stgject6PEf1Tvn6HY6Zot
- brands/modutech/plugin.py +6 -1
- test_answer_interpreter.py +7 -3
brands/modutech/plugin.py
CHANGED
|
@@ -342,7 +342,12 @@ class ModutechPlugin:
|
|
| 342 |
if v is not None and not (flow == "pitch_confirm" and NF._NO_RX.search(a)):
|
| 343 |
return AnswerReading("value", v, "mm")
|
| 344 |
if flow == "pitch_confirm" and not nums:
|
| 345 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
if yes != no:
|
| 347 |
return AnswerReading("yes" if yes else "no")
|
| 348 |
if flow == "temp" and len(nums) == 1:
|
|
|
|
| 342 |
if v is not None and not (flow == "pitch_confirm" and NF._NO_RX.search(a)):
|
| 343 |
return AnswerReading("value", v, "mm")
|
| 344 |
if flow == "pitch_confirm" and not nums:
|
| 345 |
+
# "ไม่ใช่" มีคำว่า "ใช่" อยู่ข้างใน — ตัดคำปฏิเสธออกก่อนหาคำรับ (lat2 26 ต.ค.: "ไม่ใช่" ไป LLM +2.1 วิ)
|
| 346 |
+
no = bool(NF._NO_RX.search(a))
|
| 347 |
+
rest = NF._NO_RX.sub(" ", a)
|
| 348 |
+
if no: # "ไม่ใช่ครับ" — หางเสียงไม่ใช่คำรับ
|
| 349 |
+
rest = re.sub(r"ครับ|ค่ะ|คะ|นะ|จ้า", " ", rest)
|
| 350 |
+
yes = bool(NF._YES_RX.search(rest))
|
| 351 |
if yes != no:
|
| 352 |
return AnswerReading("yes" if yes else "no")
|
| 353 |
if flow == "temp" and len(nums) == 1:
|
test_answer_interpreter.py
CHANGED
|
@@ -163,9 +163,13 @@ ok("\"ไม่แน่ใจ น่าจะ 2 นิ้ว\" (คำว่า
|
|
| 163 |
sl(st).get("pitch_mm") == 50.8, (seen_llm, sl(st)))
|
| 164 |
seen_llm.clear()
|
| 165 |
TABLE["ไม่ใช่ครับ"] = {"kind": "no"}
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
|
| 170 |
plugin._interpreter = AnswerInterpreter(boom)
|
| 171 |
ds, st = run(["สายพาน modutech รุ่นไหนดี", "ไก่", "2 นิ้ว"])
|
|
|
|
| 163 |
sl(st).get("pitch_mm") == 50.8, (seen_llm, sl(st)))
|
| 164 |
seen_llm.clear()
|
| 165 |
TABLE["ไม่ใช่ครับ"] = {"kind": "no"}
|
| 166 |
+
for no_ans in ("ไม่ใช่", "ไม่ใช่ครับ"):
|
| 167 |
+
ds, st = run(["สายพาน modutech รุ่นไหนดี", "ไก่", "50.6", no_ans])
|
| 168 |
+
ok(f"\"{no_ans}\" → กฎอ่านเป็นปฏิเสธ ไม่เรียก LLM", seen_llm == []
|
| 169 |
+
and ds[-1].reply_th.startswith("ถ้าไม่ใช่ 50.8"), (seen_llm, ds[-1].reply_th[:30]))
|
| 170 |
+
TABLE["ใช่ แต่ไม่ใช่อันนั้นนะ"] = {"kind": "no"}
|
| 171 |
+
ds, st = run(["สายพาน modutech รุ่นไหนดี", "ไก่", "50.6", "ใช่ แต่ไม่ใช่อันนั้นนะ"])
|
| 172 |
+
ok("มีทั้งคำรับและคำปฏิเสธจริง → LLM", seen_llm == ["ใช่ แต่ไม่ใช่อันนั้นนะ"], seen_llm)
|
| 173 |
|
| 174 |
plugin._interpreter = AnswerInterpreter(boom)
|
| 175 |
ds, st = run(["สายพาน modutech รุ่นไหนดี", "ไก่", "2 นิ้ว"])
|