Spaces:
Running
Running
router.js: label_blind choices
Browse files63 unmodified lines6465666768697063 unmodified linesif (!crit || typeof crit !== "object" || Object.keys(crit).length < 2 || Object.keys(crit).length > 255)throw new Error(`questions.${qid}: a choice needs 2–255 options`);const labels = Object.keys(crit);const opts = labels.map((k) => (pyStrip(text(crit[k])) ? `${k}: ${text(crit[k])}` : k));const kind = spec.ordinal === true ? "score" : "choose"; // Decima extension: a choice scored by the ordinal head it was trained withif (kind === "score" && labels.length > 10) throw new Error(`questions.${qid}: an ordinal choice takes 2–10 labels`);return { type: t, q: { text: qt, choices: opts, kind, lang }, keys: labels };63 unmodified lines64656667686970717263 unmodified linesif (!crit || typeof crit !== "object" || Object.keys(crit).length < 2 || Object.keys(crit).length > 255)throw new Error(`questions.${qid}: a choice needs 2–255 options`);const labels = Object.keys(crit);const blind = spec.label_blind === true; // Decima extension: description only, so renaming an option can't move the decisionconst opts = labels.map((k) => (pyStrip(text(crit[k])) ? (blind ? text(crit[k]) : `${k}: ${text(crit[k])}`) : k));if (new Set(opts).size < opts.length) throw new Error(`questions.${qid}: two options render to the same text`);const kind = spec.ordinal === true ? "score" : "choose"; // Decima extension: a choice scored by the ordinal head it was trained withif (kind === "score" && labels.length > 10) throw new Error(`questions.${qid}: an ordinal choice takes 2–10 labels`);return { type: t, q: { text: qt, choices: opts, kind, lang }, keys: labels };
router.js+3-1