Skip to content

Commit e5b2f5c

Browse files
review: the digit fold must not swallow the pass-through
foldNativeDigits returns a NON-digit unchanged, so ADLAM[ch] ?? foldNativeDigits(ch) was never undefined — which killed the pass-through branch below it and, worse, set lastBase (the gemination target) from characters that are not Adlam letters. A stray ’ or an Arabic-Indic digit before U+1E946 doubled itself instead of the last real letter. It also folded every other script's digits inside an Adlam token. Guarded on the Adlam digit range, which is what the DIGITS lookup it replaced covered. Verified against main on 1292 generated words that now include stray and foreign characters precisely so this path is exercised — the earlier 998-word run used only well-formed Adlam and missed it. Also split balochi's stacked header: the first paragraph still described the flat romanVowels key from #751 rather than the six-table roman object that landed, so it now sits on roman.vowelLetters where it is true. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Lc3WnUgogC7okV7n53vjr
1 parent da63df9 commit e5b2f5c

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/languages/balochi/balochi.jsonc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,13 @@
3838
// abjad intends.
3939
"vowelLetters": ["ا", "آ", "و", "ى", "ی", "ے"],
4040

41-
// ⚠ ORTHOGRAPHIC, NOT IPA, AND NOT THE ARABIC-SCRIPT LIST ABOVE. Balochi is written in both scripts;
42-
// phonemizeRoman scans the ROMAN spelling, and these are its vowel letters. "vowelLetters" above is
43-
// the Arabic-script set, for a different scan in the same engine.
4441
// ⚠ THE ROMAN ORTHOGRAPHY, a SECOND full g2p in the same engine — Balochi is written in both scripts and
4542
// this half is PHONEMIC where the Arabic half is defective, so it resolves to full IPA on its own rather
4643
// than leaning on the lexicon. The two halves share nothing but the language.
4744
"roman": {
48-
// The vowel letters (the scan's own class), then long vs short by diacritic. A MACRON writes length.
45+
// ⚠ ORTHOGRAPHIC, NOT IPA, AND NOT THE ARABIC-SCRIPT "vowelLetters" ABOVE — that one is the abjad's
46+
// set, for the other scan in this same engine. These are the Roman letters, then long vs short by
47+
// diacritic; a MACRON writes length.
4948
// ⚠ ⟨e o⟩ ARE LONG IN BOTH COLUMNS: Balochi has no short /e o/, so an unmarked ⟨e⟩ is still [eː].
5049
"vowelLetters": ["a", "e", "i", "o", "u"],
5150
"long": { "a": "", "e": "", "i": "", "o": "", "u": "" },

src/languages/fula/fulaAdlam.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const LENGTHENER = new Set(MANIFEST.adlam.lengtheners);
2323
const GEMINATION = MANIFEST.adlam.gemination;
2424
const HAMZA = MANIFEST.adlam.hamza;
2525
const DROP = new Set(MANIFEST.adlam.drop);
26+
const ADLAM_DIGIT = /[\u{1E950}-\u{1E959}]/u; // 𞥐–𞥙, the only digits this scan may fold
2627
const VOWELS = new Set(MANIFEST.latinVowels); // the LATIN spelling vowels (fula.jsonc)
2728

2829
/** Is any character of `s` in the Adlam block (U+1E900–1E95F)? */
@@ -47,7 +48,11 @@ export function adlamToLatin(word: string): string {
4748
if (ch === GEMINATION) { out += lastBase; continue; }
4849
if (ch === HAMZA) { out += "q"; lastBase = "q"; continue; }
4950
if (DROP.has(ch)) continue;
50-
const lat = ADLAM[ch] ?? foldNativeDigits(ch);
51+
// ⚠ THE DIGIT TEST MUST STAY NARROW. foldNativeDigits folds EVERY script's digits and returns a
52+
// non-digit unchanged, so calling it unguarded would (a) make `lat` never undefined, killing the
53+
// pass-through below, and (b) set lastBase — the gemination target — from a character that is not
54+
// an Adlam letter at all. Guarding on the Adlam digit range keeps the undefined signal intact.
55+
const lat = ADLAM[ch] ?? (ADLAM_DIGIT.test(ch) ? foldNativeDigits(ch) : undefined);
5156
if (lat !== undefined) { out += lat; lastBase = lat; } else out += raw; // pass unknown through
5257
}
5358
return out;

0 commit comments

Comments
 (0)