訂明本例驗收任務
假設櫃位指示須包含指定完整字樣,大小寫也要相同,前後可有其他文字。近義詞或改大小寫都不接;目標空白無效。本項只查用字,不混同資料準確或語句質素。
- 保存確切指定字樣
- 不改大小寫核對草稿
- 字面要求另列結果
指定字樣空白,先修驗收要求。
使用已填個案
| 個案 | 已提供輸入 | 預期結構化結果 | 判斷及原因 |
|---|---|---|---|
| 櫃位名稱完全相同 | {"term":"North Desk","draft":"Ask North Desk for the folder."} | {"matched":true} | 草稿出現完整指定字樣。 |
| 改成小寫 | {"term":"North Desk","draft":"Ask north desk for the folder."} | {"matched":false} | 本例分大小寫,小寫不通過。 |
| 只用了近義說法 | {"term":"North Desk","draft":"Ask the northern counter."} | {"matched":false} | 意思近似也不是指定名稱字樣。 |
逐步處理 synonym-only 個案,須得到甚麼結果?原因是甚麼?
查看參考答案
{"matched":false}。意思近似也不是指定名稱字樣。
執行完整本機驗算
import assert from 'node:assert/strict';
function evaluate(x){return x.term.length?{matched:x.draft.includes(x.term)}:{error:'empty-term'};}
const cases = [
{
"id": "literal-name",
"input": {
"term": "North Desk",
"draft": "Ask North Desk for the folder."
},
"expected": {
"matched": true
}
},
{
"id": "case-variant",
"input": {
"term": "North Desk",
"draft": "Ask north desk for the folder."
},
"expected": {
"matched": false
}
},
{
"id": "synonym-only",
"input": {
"term": "North Desk",
"draft": "Ask the northern counter."
},
"expected": {
"matched": false
}
}
];
for (const c of cases) assert.deepEqual(evaluate(c.input), c.expected, c.id);
console.log(JSON.stringify({checked:cases.length,caseIds:cases.map(c=>c.id)}));
若要字詞邊界或全欄相等,另訂準則;本例是包含完整字樣。此項通過不代表整份草稿獲批。