From fbddfea702b5ee417de0003eae69500eb3df69e6 Mon Sep 17 00:00:00 2001 From: gator Date: Tue, 22 Sep 2026 08:34:32 +0000 Subject: [PATCH] manuscript: green only for runs of three or more of Baum's words --- manuscript.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/manuscript.html b/manuscript.html index 7164532..db975b8 100644 --- a/manuscript.html +++ b/manuscript.html @@ -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 }; }