commit 451536a00163d4b21904c7f4c527912652572d1c
parent e47b78a89f5b69eca0ec35d94e150f60d6d12420
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 12 Nov 2026 08:38:14 -0500
sweep-pipeline: a neutral label, heading and run topic is a grounded noun-phrase topic, held by closed lists (D2 round b review)
The review found the neutral form still attributing: section headings were
only checked against a short word list and never grounded ("Main Actress's
Comments" over twelve quotes none of them hers, "Showrunner's Comments",
"Wizards of the Coast's Response", "Fan Reactions"), labels passed with a
verb or a pronoun ("acolyte writer blames filon", "The Acolyte hates white
people", "his love of the show", "she is guilty of fraud"), and the model's
raw topic was every refused label's fallback and the report's title.
labelProblem (neutralClaim.ts), token by token, refuses: (i) a personal or
possessive pronoun; (ii) a word of saying, thinking, feeling or judging in any
of its forms, spelled out form by form (comments, reaction, response,
statement, accusation, criticism, blames, hates, loves, admission,
confession, opinion, take, stance, lying, defending, guilty, …; "viewership"
and "states" are not on it); (iii) a copula or auxiliary (am is are was were
be been being has have had does did) or a contracted verb (it's, they're,
isn't); (iv) a person-role in the possessive (the actress's, the
showrunner's); (v) the host's name. Grounding stays.
Headings get the same rules AND grounding (in the section's labels, quotes
and recordings' titles, or the question); a heading that fails is code's: the
commonest label of its quotes, else the run's topic, with an ordinal when an
earlier section has it. The run's topic is the first of the model's topic,
the topic with the subject's names off, the rare terms, that passes the label
rules; else "the question's subject" -- never the raw string. Each refusal and
replacement is logged and traced.
A label is read to 200 characters (the old trailing trim was quadratic: 40k
characters took 4.8 s). In the sentence form a quote kept on a read-aloud
cue is meaning-checked last, so it never spends an unmarked one's budget
(MAX_MEANING_CHECKS).
Tests: the review's headings and labels and more of their shapes are refused
whatever the quote holds; "the acolyte ratings", "disney star wars budget",
"wizards of the coast ban policy" pass; every label/heading/title/date
function under 50 ms on long and adversarial text; the pipeline end to end
with a topic that attributes and an attributing heading; the marked quote's
meaning check is the last.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
3 files changed, 239 insertions(+), 41 deletions(-)
diff --git a/common/lib/report/draft/tasks/neutralClaim.ts b/common/lib/report/draft/tasks/neutralClaim.ts
@@ -25,6 +25,14 @@ export { CLAIM_FORMS, type ClaimForm } from "../../../generationSettings";
export const MAX_TOPIC_WORDS = 8;
+// The words of a neutral report's coverage line that say its lines are code's
+// (a revision reads them: ./revise-report.ts keeps such a report neutral).
+export const NEUTRAL_LINES_NOTE = "each line, its citation and its link are written by code and say where the words are, not who is speaking";
+
+export function isNeutralSweep(md: string): boolean {
+ return md.includes(NEUTRAL_LINES_NOTE);
+}
+
export const NEUTRAL_EXTRACT_SYSTEM =
"You read excerpts of an automatic transcript and pick out passages that bear on a research question. Rules: (1) " +
"Only use the excerpt. (2) Each quote is copied EXACTLY, character for character, from consecutive transcript lines, " +
@@ -68,25 +76,108 @@ export const NEUTRAL_GROUP_SYSTEM =
"noun phrase about the subject matter: it never says who said something, what anyone thinks, or whether anything is " +
"true or good.";
-// A verb (or noun) of saying or thinking: a label or heading that has one
-// attributes, and the neutral form attributes nothing.
-const ATTRIBUTES =
- /\b(?:says?|said|saying|tells?|told|thinks?|thought|thoughts|believes?|belie[fv]s?|claims?|claimed|argues?|argued|states?|stated|admits?|admitted|insists?|calls?|called|slams?|blasts?|mocks?|mocked|rants?|opinions?|views?|stance|takes?|reacts?|reaction|responds?|feels?|feelings?|according)\b/i;
+// WHAT A LABEL OR A HEADING NEVER CARRIES. A label (and a section heading) is
+// a noun-phrase TOPIC — what the words are about — never a proposition about
+// who said, thought, did or is something. The rules are a few closed lists,
+// read token by token (review of round b, 12 Nov 2026: "Main Actress's
+// Comments" over twelve quotes none of them hers, "acolyte writer blames
+// filon", "The Acolyte hates white people", "his love of the show"):
+// (i) no personal or possessive pronoun (he, his, she, her, they, their, …);
+// (ii) no word of saying, thinking, feeling or judging, in any of its forms
+// (says, comments, reaction, blames, hates, loves, admission, lying, …);
+// (iii) no copula or auxiliary (is, are, was, were, be, been, being, has,
+// have, had, does, did, am) and no contracted verb (it's, they're,
+// isn't, …): those make it a statement;
+// (iv) no person-role in the possessive (the actress's …, the showrunner's …);
+// (v) no name of the host.
+// A possessive followed by a word of (ii) is refused by (ii) alone. Then the
+// content words must be GROUNDED (topicLabel, neutralHeading). Each list is
+// spelled out form by form, so what it refuses can be read here.
+const PRONOUNS = new Set(
+ "i me my mine myself we us our ours ourselves you your yours yourself yourselves he him his himself she her hers herself they them their theirs themselves themself".split(" "),
+);
+const COPULAS = new Set("am is are was were be been being has have had does did".split(" "));
+const ATTRIBUTION = new Set(
+ `
+ say says said saying sayings tell tells told telling talk talks talked talking speak speaks spoke spoken speaking speech speeches
+ ask asks asked asking explain explains explained explaining suggest suggests suggested suggesting suggestion suggestions
+ think thinks thought thoughts thinking believe believes believed believing belief beliefs
+ claim claims claimed claiming argue argues argued arguing argument arguments stated stating statement statements
+ admit admits admitted admitting admission admissions confess confesses confessed confessing confession confessions
+ insist insists insisted insisting call calls called calling slam slams slammed slamming blast blasts blasted blasting
+ mock mocks mocked mocking rant rants ranted ranting rave raves raved raving rip rips ripped ripping
+ trash trashes trashed trashing roast roasts roasted roasting expose exposes exposed exposing
+ opinion opinions view views stance stances position positions take takes took taking
+ react reacts reacted reacting reaction reactions respond responds responded responding response responses
+ reply replies replied replying feel feels felt feeling feelings according
+ comment comments commented commenting commentary remark remarks remarked remarking
+ accuse accuses accused accusing accusation accusations allege alleges alleged alleging allegation allegations
+ criticism criticisms criticize criticizes criticized criticizing criticise criticises criticised criticising critique critiques
+ blame blames blamed blaming hate hates hated hating hatred love loves loved loving despise despises despised
+ praise praises praised praising condemn condemns condemned condemning condemnation denounce denounces denounced denouncing
+ deny denies denied denying denial denials defend defends defended defending defense defence
+ apologize apologizes apologized apologizing apologise apologises apologised apologising apology apologies
+ agree agrees agreed agreeing agreement disagree disagrees disagreed disagreeing disagreement
+ complain complains complained complaining complaint complaints endorse endorses endorsed endorsing endorsement
+ oppose opposes opposed opposing attack attacks attacked attacking
+ lie lies lied lying liar liars guilt guilty judgement judgment judgements judgments verdict
+`
+ .split(/\s+/)
+ .filter(Boolean),
+);
+// The raw text a label is cleaned from, at most this long (the trailing
+// punctuation trim is linear, and nothing longer is a label anyway).
+export const MAX_RAW_LABEL_CHARS = 200;
+
+// Who a possessive may not be (iv): a person by role.
+const ROLES = new Set(
+ "actor actress actors actresses star stars showrunner showrunners writer writers director directors creator creators producer producers host hosts streamer streamers youtuber youtubers ceo ceos president owner owners boss employee employees staff fan fans critic critics reviewer reviewers journalist journalists reporter reporters spokesperson spokesman spokeswoman executive executives".split(
+ " ",
+ ),
+);
+// "it's", "that's", "there's": the 's is "is".
+const IS_CONTRACTED = new Set("it that there here what who where how when why".split(" "));
const esc = (s: string) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
+const tokensOf = (s: string) =>
+ s
+ .toLowerCase()
+ .replace(/[’‘`]/g, "'")
+ .split(/[^a-z0-9']+/)
+ .map((t) => t.replace(/^'+/, ""))
+ .filter(Boolean);
-// Does this text name the host or say who thinks what?
-export function attributes(text: string, hosts: readonly string[] = []): boolean {
- if (ATTRIBUTES.test(text)) return true;
+// Why this label or heading is not a neutral topic, or null when it is one.
+// `sentence`: the text is a sentence (a revision's summary), so (iii) does not
+// apply and it may run to MAX_SENTENCE_CHARS; (i), (ii), (iv) and (v) do.
+export const MAX_SENTENCE_CHARS = 1000;
+export function labelProblem(text: string, hosts: readonly string[] = [], o: { sentence?: boolean } = {}): string | null {
+ const max = o.sentence ? MAX_SENTENCE_CHARS : MAX_RAW_LABEL_CHARS;
+ if (text.length > max) return `longer than ${max} characters`;
+ for (const tok of tokensOf(text)) {
+ const possessive = /'s?$/.test(tok) && !/'(?:re|ve|ll|d|m|t)$/.test(tok);
+ const base = tok.replace(/'s?$/, "");
+ if (!o.sentence && (/[a-z]'(?:re|ve|ll|d|m|t)$/.test(tok) || (tok.endsWith("'s") && IS_CONTRACTED.has(base)))) return `“${tok}” is a contracted verb: a label is a noun phrase, not a statement`;
+ if (PRONOUNS.has(base)) return `“${tok}” is a pronoun: a label names what the words are about, not a person`;
+ if (!o.sentence && COPULAS.has(base)) return `“${tok}” makes it a statement: a label is a noun phrase`;
+ if (ATTRIBUTION.has(base)) return `“${tok}” is a word of saying, thinking or judging`;
+ if (possessive && ROLES.has(base)) return `“${tok}” puts a person in the possessive`;
+ }
const t = ` ${strictNormalize(text)} `;
- return hosts.some((h) => {
+ const host = hosts.find((h) => {
const k = strictNormalize(h);
return k.length >= 3 && new RegExp(` ${esc(k)}s? `).test(t);
});
+ return host ? `it names ${host}` : null;
+}
+
+// Does this text name the host or say who says, thinks or is what?
+export function attributes(text: string, hosts: readonly string[] = []): boolean {
+ return labelProblem(text, hosts) !== null;
}
const LABEL_STOP = new Set(
- "the a an of on in at to for and or with from by about its his her their this that these those is are was were be being as it into over new him them they she who whom what why how when where which someone something anyone has have had not no more most than then also own other".split(
+ "the a an of on in at to for and or with from by about its this that these those as it into over new who whom what why how when where which someone something anyone not no more most than then also own other".split(
" ",
),
);
@@ -96,33 +187,66 @@ const contentWords = (s: string) =>
.split(" ")
.filter((w) => w.length >= 3 && !LABEL_STOP.has(w));
+// The first content word of `text` found in none of `ground`, or null.
+// (Each ground text is read to its first GROUND_CHARS: a quote, the
+// transcript before it, a title or the question is far shorter.)
+const GROUND_CHARS = 4000;
+export function ungrounded(text: string, ground: readonly string[]): string | null {
+ const have = new Set(ground.flatMap((g) => contentWords(g.slice(0, GROUND_CHARS))).map(stem));
+ return contentWords(text).find((w) => !have.has(stem(w))) ?? null;
+}
+
export type TopicLabel = { label: string; from: "model" | "fallback"; why?: string };
+const TRAILING = new Set([..." .:;,!?—–-"]);
+
+// A model's label cleaned: no quotes or markup, no "on:"/"about", no trailing
+// punctuation, whitespace collapsed.
+export function cleanLabel(raw: unknown): string {
+ let s = typeof raw === "string" ? raw.slice(0, MAX_RAW_LABEL_CHARS) : "";
+ s = s
+ .replace(/["“”‘’'`*_#[\]()<>|~\\{}$]/g, (c) => (c === "'" || c === "’" ? "'" : " "))
+ .replace(/\s+/g, " ")
+ .trim()
+ .replace(/^(?:on|about|re|regarding|topic)\b[:\s]*/i, "");
+ let end = s.length;
+ while (end > 0 && TRAILING.has(s[end - 1]!)) end--;
+ return s.slice(0, end).trim();
+}
+
// The model's topic label, held down by code; the run's topic when it fails.
// `ground`: the texts a label's words may come from (the quote, the
// transcript before it, the recording's title, the question's terms).
export function topicLabel(raw: unknown, o: { fallback: string; hosts?: readonly string[]; ground: readonly string[] }): TopicLabel {
const fb = (why: string): TopicLabel => ({ label: o.fallback, from: "fallback", why });
- let s = typeof raw === "string" ? raw : "";
- s = s
- .replace(/["“”‘’'`*_#[\]()<>|]/g, (c) => (c === "'" || c === "’" ? "'" : " "))
- .replace(/\s+/g, " ")
- .trim()
- .replace(/^(?:on|about|re|regarding|topic)\b[:\s]*/i, "")
- .replace(/[\s.:;,!?—–-]+$/g, "")
- .trim();
+ const s = cleanLabel(raw);
if (!s) return fb("no label");
const n = s.split(" ").length;
if (n > MAX_TOPIC_WORDS) return fb(`a label of ${n} words (at most ${MAX_TOPIC_WORDS})`);
- if (attributes(s, o.hosts)) return fb("the label says who says or thinks something");
- const words = contentWords(s);
- if (!words.length) return fb("a label of no content words");
- const have = new Set(o.ground.flatMap((g) => contentWords(g)).map(stem));
- const loose = words.find((w) => !have.has(stem(w)));
+ const bad = labelProblem(s, o.hosts);
+ if (bad) return fb(bad);
+ if (!contentWords(s).length) return fb("a label of no content words");
+ const loose = ungrounded(s, o.ground);
if (loose) return fb(`“${loose}” is not in the quote, the transcript before it, the title or the question`);
return { label: s, from: "model" };
}
+// The run's topic, the neutral form's fallback label and its report title: the
+// first candidate (the model's topic as it wrote it, then with the subject's
+// names off, then the rare terms) that passes the label rules, grounded in the
+// question and the terms; else "the question's subject".
+export function runTopicOf(candidates: readonly unknown[], o: { hosts?: readonly string[]; ground: readonly string[] }): { topic: string; refused: { candidate: string; why: string }[] } {
+ const refused: { candidate: string; why: string }[] = [];
+ for (const c of candidates) {
+ const s = cleanLabel(c);
+ if (!s) continue;
+ const r = topicLabel(s, { fallback: "", ...(o.hosts ? { hosts: o.hosts } : {}), ground: o.ground });
+ if (r.from === "model") return { topic: r.label, refused };
+ refused.push({ candidate: s, why: r.why! });
+ }
+ return { topic: "the question's subject", refused };
+}
+
const MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
// "2024-06-05" (or "20240605") → "5 June 2024"; anything else as it is.
@@ -140,6 +264,7 @@ export function humanDate(date: string): string {
// markup, no brackets.
export function plainTitle(title: string, max = 90): string {
const t = title
+ .slice(0, max * 4)
.replace(/["“”«»]/g, "")
.replace(/[[\]()<>*_`#|]/g, " ")
.replace(/\s+/g, " ")
@@ -161,12 +286,31 @@ export function neutralTitle(topic: string, channels: readonly string[]): string
return `${head}: quotes from ${from || "the archive"}`.slice(0, 90);
}
-// A section heading the grouping call wrote: kept unless it attributes; then
-// the commonest label of its items.
-export function neutralHeading(heading: string, labels: readonly string[], hosts: readonly string[] = []): string {
- if (heading && !attributes(heading, hosts)) return heading;
+// A section heading the grouping call wrote: kept when it passes the label
+// rules (labelProblem) AND every content word of it is grounded in the
+// section's own labels and quotes, its recordings' titles or the question.
+// Else code writes it: the commonest label of the section's quotes (labels are
+// held down already), or the run's topic; a heading already used gets an
+// ordinal. `used`: the headings of the sections before it (lowercase).
+export function neutralHeading(
+ heading: string,
+ o: { labels: readonly string[]; ground: readonly string[]; topic: string; hosts?: readonly string[]; used?: Set<string> },
+): { heading: string; from: "model" | "code"; why?: string } {
+ const h = cleanLabel(heading).slice(0, 60).trim();
+ const bad = h ? labelProblem(h, o.hosts) : "no heading";
+ const loose = bad ? null : ungrounded(h, [...o.labels, ...o.ground]);
+ const why = bad ?? (loose ? `“${loose}” is in none of its quotes, labels or titles, nor the question` : null);
+ const used = o.used ?? new Set<string>();
+ if (!why && !used.has(h.toLowerCase())) {
+ used.add(h.toLowerCase());
+ return { heading: h, from: "model" };
+ }
const count = new Map<string, number>();
- for (const l of labels) count.set(l.toLowerCase(), (count.get(l.toLowerCase()) ?? 0) + 1);
- const best = [...count.entries()].sort((a, b) => b[1] - a[1])[0]?.[0];
- return best ? best[0]!.toUpperCase() + best.slice(1) : "Quotes";
+ for (const l of o.labels) count.set(l.toLowerCase(), (count.get(l.toLowerCase()) ?? 0) + 1);
+ const best = [...count.entries()].sort((a, b) => b[1] - a[1])[0]?.[0] ?? o.topic.toLowerCase();
+ const base = (best ? best[0]!.toUpperCase() + best.slice(1) : "Quotes").slice(0, 54).trim();
+ let out = base;
+ for (let k = 2; used.has(out.toLowerCase()); k++) out = `${base} (${k})`;
+ used.add(out.toLowerCase());
+ return { heading: out, from: "code", why: why ?? "a heading an earlier section has" };
}
diff --git a/common/lib/report/draft/tasks/sweep-pipeline.ts b/common/lib/report/draft/tasks/sweep-pipeline.ts
@@ -36,7 +36,7 @@ import { TaskInputError, runOnIteration, type TaskHandle, type TaskOutcome } fro
import { CoverageTally, enumerateOf, traceReport } from "./trace";
import { GATE_CHARS, lintClaim, MIN_KEPT, onTopicBy, quoteContext } from "./claimChecks";
import { CHECK_BY_EAR, decideMeaning, MEANING_SCHEMA, MEANING_SYSTEM, meaningPrompt, readMeaning, type MeaningAnswer, type MeaningDecision } from "./meaning";
-import { NEUTRAL_EXTRACT_SYSTEM, NEUTRAL_GROUP_SYSTEM, neutralExtractSchema, neutralHeading, neutralSentence, neutralTitle, topicLabel, type ClaimForm, type TopicLabel } from "./neutralClaim";
+import { NEUTRAL_EXTRACT_SYSTEM, NEUTRAL_GROUP_SYSTEM, NEUTRAL_LINES_NOTE, neutralExtractSchema, neutralHeading, neutralSentence, neutralTitle, runTopicOf, topicLabel, type ClaimForm, type TopicLabel } from "./neutralClaim";
import { cuesLine, READ_ALOUD_FLAG, readAloudCues, type ReadAloudCue, type ReadAloudMode } from "./readAloud";
export { lintClaim };
@@ -471,10 +471,19 @@ async function pipelineBody(h: TaskHandle, input: SweepPipelineInput): Promise<T
// The topic the model named, as the gate reads it (the subject's names off).
topic = normalizeTerm(topic, names);
const rare = rareTermsOf(usable);
- // The neutral form's fallback label: the topic the model named for the
- // question, else the rarest term.
+ // The neutral form's fallback label and its report's title: the topic the
+ // model named for the question, else with the subject's names off, else the
+ // rarest term — the first that passes the label rules (never the model's
+ // raw words unchecked: a topic that attributes would be every refused
+ // label's and the title).
const hostNames = [...names];
- const runTopic = topicShown || topic || rare[0] || terms[0]!;
+ const rt = runTopicOf([topicShown, topic, ...rare, ...terms], { hosts: hostNames, ground: [question, ...terms] });
+ const runTopic = rt.topic;
+ if (neutral && rt.refused.length) {
+ const line = `the run's topic: ${rt.refused.map((r) => `“${r.candidate}” refused (${r.why})`).join("; ")}; “${runTopic}” used`;
+ h.log(line);
+ h.trace({ t: "note", text: line });
+ }
h.trace({
t: "note",
text: `scope ${scopeSize} recording(s); terms by rarity: ${usable.map((st) => `${st.term} ${st.videos}${st.partial ? "+" : ""} (${(st.share * 100).toFixed(1)}%, idf ${st.idf.toFixed(2)}${st.nominates ? "" : ", scores only"})`).join("; ")}; rare: ${rare.join(", ")}`,
@@ -746,7 +755,10 @@ async function pipelineBody(h: TaskHandle, input: SweepPipelineInput): Promise<T
const host = askedAboutName(question) ?? "the channel's host (its own voice)";
// The neutral form has no drafted sentence to check: no call. Its items
// are stored the same way (items.jsonl), with the label and the cues.
- const toCheck = neutral ? [] : kept.slice(0, MAX_MEANING_CHECKS);
+ // A quote kept on a read-aloud cue is checked last: it is shown marked to
+ // check by ear whatever the check says, so it never spends the budget of an
+ // unmarked one.
+ const toCheck = neutral ? [] : [...kept.filter((r) => !r.mark), ...kept.filter((r) => r.mark)].slice(0, MAX_MEANING_CHECKS);
const unchecked = neutral ? 0 : kept.length - toCheck.length;
const items: Record<string, unknown>[] = [];
const tally: Record<string, number> = {};
@@ -862,9 +874,22 @@ async function pipelineBody(h: TaskHandle, input: SweepPipelineInput): Promise<T
});
let sections = raw.map((s, i) => ({ heading: s.heading, nums: s.nums.filter((n) => home.get(n) === i) }));
const rest = pool.map((_, i) => i + 1).filter((n) => !home.has(n));
- // A heading that says who said or thinks something is not the neutral
- // form's: the commonest label of its quotes instead.
- if (neutral) sections = sections.map((s) => ({ ...s, heading: neutralHeading(s.heading, s.nums.map((n) => pool[n - 1]!.label!.label), hostNames).slice(0, 60) }));
+ // The neutral form's headings are held down like its labels: a heading that
+ // is not a grounded noun-phrase topic (neutralHeading) is code's, built from
+ // the section's labels.
+ if (neutral) {
+ const used = new Set<string>();
+ sections = sections.map((s) => {
+ const recs = s.nums.map((n) => pool[n - 1]!);
+ const r = neutralHeading(s.heading, { labels: recs.map((x) => x.label!.label), ground: [...recs.flatMap((x) => [x.quote, x.title]), question], topic: runTopic, hosts: hostNames, used });
+ if (r.from === "code") {
+ const line = `heading “${s.heading}” replaced by “${r.heading}” (${r.why})`;
+ h.log(line);
+ h.trace({ t: "note", text: line });
+ }
+ return { ...s, heading: r.heading };
+ });
+ }
if (rest.length) sections.push({ heading: neutral ? "Other quotes" : "Other findings", nums: rest });
sections = sections.filter((s) => s.nums.length);
let leftOut = kept.length - pool.length - marked.length + unchecked;
@@ -1043,7 +1068,7 @@ function writeMarkdown(
`found ${c.kept}, dropped ${c.dropped} (not verbatim, unusable, or not passing the quote check), ${c.leftOut} left out ` +
`by the caps. ` +
(c.neutral
- ? `The quotes were picked and their topics labelled by ${c.model}; each line, its citation and its link are written by code and say where the words are, not who is speaking; every quote was checked word for word against its transcript.`
+ ? `The quotes were picked and their topics labelled by ${c.model}; ${NEUTRAL_LINES_NOTE}; every quote was checked word for word against its transcript.`
: `Drafted by ${c.model}; every quote was checked word for word against its transcript.`) +
(c.readAloud === "flag" && byEar
? ` ${byEar} quote(s) are marked to check by ear: the transcript around them has a sign of reading aloud (a tweet, a headline, an article, “it says”), so the words may not be the speaker's own.`
diff --git a/mcp/src/draftTasks.test.ts b/mcp/src/draftTasks.test.ts
@@ -448,7 +448,7 @@ test("sweep-pipeline, the speaker-neutral form (D2 round b): code writes 'In <ti
["neutral", "the pie contest", "keep"],
["neutral", "the pie contest", "mark"],
]);
- assert.equal(items[1].topicRefused, "the label says who says or thinks something");
+ assert.equal(items[1].topicRefused, "“says” is a word of saying, thinking or judging");
assert.deepEqual(items[2].readAloud, [{ cue: "names the host", where: "quote", match: "finalist" }]);
assert.deepEqual(after.checks?.map((c) => [c.name, c.ok]), [["read-aloud", true], ["convert", true], ["quotes", true], ["lint", true]]);
const trace = await traceOf("synth-neutral", it.n);
@@ -456,6 +456,26 @@ test("sweep-pipeline, the speaker-neutral form (D2 round b): code writes 'In <ti
assert.match(trace.find((e) => e.t === "check" && e.quote === "I have never met the other finalist")!.reason, /read-aloud cue: names the host \(quote: “finalist”\) — to check by ear/);
});
+test("sweep-pipeline, the neutral form (review of round b): the run's topic and every heading pass the label rules — a topic that attributes is never the title or a fallback label, a heading that attributes or is not grounded is code's", async () => {
+ const { r, turns } = await neutralTurns();
+ turns[0].message.content = JSON.stringify({ terms: ["contest", "judges"], topic: "the baker hates the contest" });
+ turns[2].message.content = JSON.stringify({ title: "x", sections: [{ heading: "Fan Reactions", findings: [1] }, { heading: "The pie contest", findings: [2] }] });
+ ol.push(...turns);
+ const it = await createIteration("synth-neutral-heads", { kind: "sweep", model: r.model, question: "What has the baker said about the pie contest?", scope: { channels: r.channels } }, paths);
+ const d = deps();
+ const out = await runTask({ task: "sweep-pipeline", article: "synth-neutral-heads", n: it.n, origin: ORIGIN, claimForm: "neutral", readAloud: "flag", hosts: ["finalist"] }, d);
+ assert.equal(out.status, "done", `${out.summary}\n${d.lines.join("\n")}`);
+ assert.equal(ol.remaining(), 0);
+ const md = (await readIterationFile("synth-neutral-heads", it.n, "sweep.md", paths))!;
+ assert.ok(!/hates/.test(md.replace(/^Question: .*$/m, "")), md);
+ assert.ok(d.lines.some((l) => l.startsWith("the run's topic: “the baker hates the contest” refused (“hates” is a word of saying, thinking or judging)")), d.lines.join("\n"));
+ const runTopic = /“([^”]+)” used$/.exec(d.lines.find((l) => l.startsWith("the run's topic:"))!)![1]!;
+ assert.match(md, new RegExp(`^# ${runTopic[0]!.toUpperCase()}${runTopic.slice(1)}: quotes from Synth Kitchen$`, "m"));
+ assert.ok(md.includes(`on ${runTopic}: "the judges were friends of mine so it felt wrong"`), "a refused label is the checked run topic");
+ assert.deepEqual([...md.matchAll(/^## (.+)$/gm)].map((m) => m[1]), ["Entering the pie contest", "The pie contest", "To check by ear", "Coverage"]);
+ assert.ok(d.lines.includes("heading “Fan Reactions” replaced by “Entering the pie contest” (“reactions” is a word of saying, thinking or judging)"), d.lines.join("\n"));
+});
+
test("sweep-pipeline read-aloud cues, drop (D2 round b): the quote is left out, with the cue as the reason", async () => {
const { r, turns } = await neutralTurns();
ol.push(...turns.slice(0, 2));
@@ -473,9 +493,16 @@ test("sweep-pipeline read-aloud cues, drop (D2 round b): the quote is left out,
assert.equal(ol.remaining(), 0, "no grouping call");
});
-test("sweep-pipeline read-aloud cues in the sentence form (D2 round b): a cued quote goes through the meaning check and stays marked to check by ear", async () => {
+test("sweep-pipeline read-aloud cues in the sentence form (D2 round b): a cued quote goes through the meaning check — last, never spending an unmarked one's budget — and stays marked to check by ear", async () => {
const r = await run("sweep-pipeline");
- ol.push(...r.turns);
+ // The meaning answers by the quote they judge (the checks' order is code's: marked last).
+ const meaningFor = (quote: string) => r.turns.slice(2, 5)[["I did not enter the contest this year", "the judges were friends of mine so it felt wrong", "next year maybe I will enter again"].indexOf(quote)];
+ const byQuote = (body: { messages?: { content?: string }[] }) => {
+ const user = String(body.messages?.at(-1)?.content ?? "");
+ const q = ["I did not enter the contest this year", "the judges were friends of mine so it felt wrong", "next year maybe I will enter again"].find((x) => user.includes(`QUOTE: ${x}\n`));
+ return meaningFor(q!);
+ };
+ ol.push(r.turns[0], r.turns[1], byQuote, byQuote, byQuote, r.turns[5]);
const it = await createIteration("synth-sentence-flag", { kind: "sweep", model: r.model, question: r.question, scope: { channels: r.channels } }, paths);
const d = deps();
// "friends" stands for the host's name.
@@ -487,6 +514,8 @@ test("sweep-pipeline read-aloud cues in the sentence form (D2 round b): a cued q
const flags = report.sections.flatMap((x: { claims?: { text: string; flag?: string }[] }) => x.claims ?? []).filter((c: { flag?: string }) => c.flag);
assert.equal(flags.length, 1, "the meaning check's own mark carries no flag; the read-aloud one does");
assert.match(flags[0].text, /the judges were friends of hers/);
+ const trace = await traceOf("synth-sentence-flag", it.n);
+ assert.equal(trace.filter((e) => e.t === "meaning").at(-1)!.quote, "the judges were friends of mine so it felt wrong", "the read-aloud-marked quote is checked last");
});
test("sweep-pipeline selection (D2 item 1): the subject's own name and generic words are never searched; the read is traced with its reasons", async () => {