manuscript: green only for runs of three or more of Baum's words

This commit is contained in:
gator 2026-09-22 08:34:32 +00:00
parent cb0f3a6b1f
commit fbddfea702

View file

@ -211,6 +211,14 @@
if (A[i] === B[j]) { mask[bw[j]] = true; i++; j++; }
else if (L[i + 1][j] >= L[i][j + 1]) i++; else j++;
}
// a lone "the" that happens to match is not Baum's sentence: only runs of
// three or more matching words count as his
var run = [];
for (var q = 0; q <= bw.length; q++) {
if (q < bw.length && mask[bw[q]]) { run.push(bw[q]); continue; }
if (run.length && run.length < 3) run.forEach(function (idx) { mask[idx] = false; });
run = [];
}
for (var k = 0; k < b.length; k++) if (/^\s+$/.test(b[k])) mask[k] = (k > 0 && mask[k - 1]) && (k + 1 < b.length && mask[k + 1]);
return { parts: b, mask: mask };
}