Natural reworded openers and exam formatting on finished quizzes
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 29s
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 29s
Checked against a quiz generated from four neuro and mental health
lectures:
- The opener rewording now asks for the plain, active openings a real
exam uses and rules out inverted sentences ("Two days of vomiting have
left a client weak", "An order is received for…"). It steps in only
above 30% of a quiz, since the exam's most common opener was 24%.
- The finished set is tidied after review: plain stems, no closing
period on phrase choices, and first-person choices to a "Which
statement…" question in quotes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
39a85ebb0c
commit
f738fbe7be
5 changed files with 68 additions and 15 deletions
|
|
@ -327,6 +327,23 @@ export function plainStem(stem: string): string {
|
|||
return stem.replace(/\*\*(\S(?:[^*]*?\S)?)\*\*/g, '$1').replace(/__(\S(?:[^_]*?\S)?)__/g, '$1');
|
||||
}
|
||||
|
||||
/** A first-person choice to a "Which statement…" question is quoted speech, as on the exam. */
|
||||
export function quoteStatement(text: string): string {
|
||||
const t = text.trim();
|
||||
if (/^["“‘']/.test(t) || !/^(?:I|I'm|I'll|I've|I'd|We|We'll|We're|My|Our)\b/.test(t)) return t;
|
||||
return `"${/[.!?]$/.test(t) ? t : `${t}.`}"`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exam choices are phrases without a closing period ("Place the child in a knee-chest position").
|
||||
* Quoted speech and choices of more than one sentence keep their punctuation.
|
||||
*/
|
||||
export function plainChoice(text: string): string {
|
||||
const t = plainStem(text.trim());
|
||||
if (/^["“‘']/.test(t) || /[.!?]\s/.test(t) || /\b(?:etc|e\.g|i\.e|vs)\.$/i.test(t)) return t;
|
||||
return t.replace(/(?<!\.)\.$/, '');
|
||||
}
|
||||
|
||||
/** How a rationale is laid out, so it reads at a glance instead of as one block of text. */
|
||||
const RATIONALE_FORMAT =
|
||||
'Format the rationale in Markdown for quick reading: one bold sentence with the key point, then 2 to 4 short bullet points (one idea each, such as the principle or framework, the physiology or drug action, the safety point). No long paragraphs, and do not repeat the choices\' "why" text, which is shown beside each choice.';
|
||||
|
|
@ -1217,6 +1234,14 @@ async function runGeneration(app: AppContext, draftId: string, req: GenerateRequ
|
|||
}
|
||||
}
|
||||
|
||||
// Exam formatting on the finished set, including questions the review rewrote.
|
||||
if (draft.kind === 'quiz') {
|
||||
draft.questions = draft.questions.map((q) => {
|
||||
const speech = /\bstatements?\b/i.test(q.stem);
|
||||
return { ...q, stem: plainStem(q.stem), options: q.type === 'numeric' ? q.options : q.options.map((o) => ({ ...o, text: plainChoice(speech ? quoteStatement(o.text) : o.text) })) };
|
||||
});
|
||||
}
|
||||
|
||||
// A short name and description of what this particular set covers.
|
||||
if (!req.title) {
|
||||
setProgress(db, draftId, 0.99, 'Naming the set', draft);
|
||||
|
|
|
|||
|
|
@ -22,8 +22,11 @@ export function stemOpener(stem: string): string {
|
|||
.join(' ');
|
||||
}
|
||||
|
||||
/** Openers used by more than a quarter of the questions (at least 4), and which of them to reword. */
|
||||
export function repeatedOpeners(questions: Pick<DraftQuestion, 'stem' | 'type'>[], share = 0.25): { opener: string; example: string; total: number; reword: number[] }[] {
|
||||
/**
|
||||
* Openers used by more than 30% of the questions (at least 4), and which of them to reword. A real
|
||||
* course exam's most common opener ("A 4-year-old…") covered about a quarter of its items.
|
||||
*/
|
||||
export function repeatedOpeners(questions: Pick<DraftQuestion, 'stem' | 'type'>[], share = 0.3): { opener: string; example: string; total: number; reword: number[] }[] {
|
||||
if (questions.length < 8) return [];
|
||||
const allow = Math.max(3, Math.floor(questions.length * share));
|
||||
const groups = new Map<string, number[]>();
|
||||
|
|
@ -71,11 +74,12 @@ export function acceptRewording(original: Pick<DraftQuestion, 'stem' | 'type'>,
|
|||
return next;
|
||||
}
|
||||
|
||||
const OPENER_SYSTEM = `You edit NCLEX-style questions for variety. Too many stems in this quiz open the same way. Reword only the opening of each listed stem so the quiz reads like a real exam, where items open in many ways, for example:
|
||||
- with the nurse's situation: "The nurse is caring for…", "While reviewing the morning laboratory results, the nurse notes…", "After receiving report, the nurse…"
|
||||
- with the setting or role: "On a medical-surgical unit…", "In the emergency department…", "The charge nurse is making assignments…", "During discharge teaching…"
|
||||
- with a finding, order or report: "A client with heart failure reports…", "The health care provider prescribes…", "Two hours after surgery, a client's…"
|
||||
- or with the question itself when the scenario is short: "Which finding in a client receiving… requires immediate follow-up?"
|
||||
const OPENER_SYSTEM = `You edit NCLEX-style questions for variety. Too many stems in this quiz open the same way. Reword only the opening of each listed stem so the quiz reads like a real nursing exam. Real exam items open in plain, natural ways, for example:
|
||||
- with the nurse: "The nurse is caring for a client who…", "The nurse is teaching a client who…", "The nurse assesses a client…", "The nurse receives report on…"
|
||||
- with a family member, when the original involves one: "The parent of a client with…", "A family member asks…"
|
||||
- with a time or event: "Two days after a stroke, a client…", "Immediately after a seizure, the client…", "During discharge teaching, a client…"
|
||||
- with the question itself when the situation is short: "Which finding in a client receiving phenytoin requires immediate follow-up?"
|
||||
Keep each stem the way a person writing an exam would say it, in the active voice with a person as the subject. Never invert the sentence to put a symptom, order or test result first ("Two days of vomiting have left a client weak", "An order is received for…", "Assessment of a client reveals…", "Expressive aphasia affects a client…", "Clear fluid is noted in…"). Do not add a setting or details that are not in the original.
|
||||
Openings with the client's age are fine elsewhere in the quiz; these stems just need a different opening from the repeated one.
|
||||
Keep everything the question tests: the same client facts, every number exactly (age, vital signs, lab values, doses), the same question asked, and an ending of "Select all that apply." where there is one. Include the age only where it is in the original, but it need not come first. Use "client", never "patient". Make the listed stems open differently from one another too. Call submit_stems once with every listed question.`;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue