mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-05 21:02:34 +01:00
fix(evals): retain contracted delivery negation in date grading
This commit is contained in:
1 parent
fefc475470
commit
2c6d746015
2 files changed
+6
-1
No files matched your search
@@ -18,6 +18,8 @@ describe("migrated historical website artifact calibration", () => {
|
||||
"The final website was delivered 21 October 2026.",
|
||||
"The approved final was delivered Oct 21.",
|
||||
"The final was delivered 2026-10-21 and imported October 26, 2026.",
|
||||
"The earlier draft wasn't delivered October 20, 2026; the final website was delivered October 21, 2026.",
|
||||
"I didn't change the files; the final website was delivered October 21, 2026.",
|
||||
])("accepts correct source dates without a literal last-week phrase: %s", reply => {
|
||||
const o = valid(); o.reply = reply; expect(gradeArtifactSearch(o).passed).toBe(true);
|
||||
});
|
||||
@@ -27,6 +29,8 @@ describe("migrated historical website artifact calibration", () => {
|
||||
"The final approved website was delivered last week, on October 26, 2026.",
|
||||
"The final approved website was not delivered last week.",
|
||||
"The final approved website was not delivered on October 21, 2026.",
|
||||
"The final approved website wasn't delivered on October 21, 2026.",
|
||||
"The final approved website wasn’t delivered last week.",
|
||||
])("rejects wrong or contradicted delivery dates: %s", reply => {
|
||||
const o = valid(); o.reply = reply; expect(gradeArtifactSearch(o).passed).toBe(false);
|
||||
});
|
||||
|
||||
@@ -63,7 +63,8 @@ export function describesHistoricalDelivery(reply: string, deliveredAt: string)
|
||||
const months = "(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)";
|
||||
const dates = new RegExp(`\\b(?:\\d{4}-\\d{2}-\\d{2}|${months}\\s+\\d{1,2}(?:st|nd|rd|th)?(?:,?\\s+\\d{4})?|\\d{1,2}(?:st|nd|rd|th)?\\s+(?:of\\s+)?${months}(?:,?\\s+\\d{4})?)\\b`, "gi");
|
||||
let matched = false;
|
||||
for (const part of reply.split(/\n+|;|(?<=[.!?])\s+/)) {
|
||||
const prose = reply.replace(/\b(was|were|is|are|has|have|had|did|does|do|could|would|should|must)n['’]t\b/gi, "$1 not");
|
||||
for (const part of prose.split(/\n+|;|(?<=[.!?])\s+/)) {
|
||||
// Qualified older history may have a different date; it is not the selected final.
|
||||
if (/\b(?:older|earlier|previous|superseded|outside)\b/i.test(part)) continue;
|
||||
if (/\blast\s+week\b/i.test(part)) {
|
||||
|
||||
Reference in new issue
Block a user