@polycode-projects/the-mechanical-code-talker 5.0.12 → 5.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -226,6 +226,14 @@ function pluralityOf(seg) {
226
226
  return null;
227
227
  }
228
228
 
229
+ // An article is NEVER directly followed by a bare copula/auxiliary — "a is",
230
+ // "an are" isn't a shape English grammar produces. The one place this
231
+ // combination shows up in tmct's own output is a stored fact whose SUBJECT
232
+ // literally is the word "a" ("noted — remembered: a is a kind of animal"),
233
+ // where the article-selection rewrite below would otherwise mistake that
234
+ // content "a" for its own article and rewrite it to "an".
235
+ const ARTICLE_NEVER_PRECEDES_RE = /^(?:is|are|was|were|am|be|been|being)$/i;
236
+
229
237
  // Rule 1 — article selection (a/an). Reads the following word: in-span when the
230
238
  // whole "a word" pair is inside one prose span; across the boundary when the
231
239
  // prose ends in "a"/"an" and the next span supplies the word (only fires when
@@ -240,6 +248,7 @@ function ruleArticle(segments, rule) {
240
248
  // hyphenated NAME ("peg-a", "option-a"), not an article — rewriting it
241
249
  // corrupts user-quoted data ("peg-a\nUtterance" read as "a Utterance").
242
250
  seg.text = seg.text.replace(/(^|[^\w-])(a|an)(\s+)([A-Za-z][\w-]*)/gi, (m, pre, art, sp, word) => {
251
+ if (ARTICLE_NEVER_PRECEDES_RE.test(word)) return m;
243
252
  const vowel = beginsWithVowelSound(word, rule);
244
253
  if (vowel === null) return m;
245
254
  return pre + matchCase(art, vowel ? "an" : "a") + sp + word;
@@ -250,7 +259,7 @@ function ruleArticle(segments, rule) {
250
259
  if (bm) {
251
260
  const next = out[i + 1];
252
261
  const word = next && typeof next.text === "string" ? leadingWord(next.text) : "";
253
- const vowel = word ? beginsWithVowelSound(word, rule) : null;
262
+ const vowel = word && !ARTICLE_NEVER_PRECEDES_RE.test(word) ? beginsWithVowelSound(word, rule) : null;
254
263
  if (vowel !== null) {
255
264
  const fixed = matchCase(bm[2], vowel ? "an" : "a");
256
265
  seg.text = seg.text.slice(0, bm.index + bm[1].length) + fixed + bm[3];
@@ -638,7 +638,12 @@ const MUD_STYLE = `
638
638
  font-family: ${MONO_STACK}; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
639
639
  padding: .32rem .7rem; border: 1px solid var(--soil-mid); border-radius: 3px;
640
640
  background: rgba(255,255,255,.5); color: var(--mud-ink);
641
+ /* A select is as wide as its longest option, and a burrow's label can run
642
+ long enough on its own to force the whole page to scroll sideways on a
643
+ phone. */
644
+ min-width: 0; max-width: 100%;
641
645
  }
646
+ #scenarioSelect { flex: 1 1 9rem; }
642
647
  .deck-select:hover { border-color: var(--burrow-glow); }
643
648
  .deck-teach { display: flex; align-items: center; gap: .3rem; font-family: ${MONO_STACK}; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--soil-mid); cursor: pointer; }
644
649
  .deck-teach input[type="checkbox"] { accent-color: var(--burrow-glow); }