sawcuengh
v0.1.0
Published
Zhuang converter. Translates Standard Zhuang Latin orthography into IPA, Old Zhuang script, tone numbers, and hyphenation syllables.
Readme
za-pron
Zhuang converter. Translates Standard Zhuang Latin orthography into IPA, Old Zhuang script, tone numbers, and hyphenation syllables.
Ported from Wiktionary Module:za-pron.
Usage
import { show, convert, isLatin } from "./za-pron";
show("mbanjcuengh");
// {
// ipa: "/ɓaːn˨˦.ɕɯŋ˧˩/",
// toneNumbers: "mbanj<sup>1</sup>cuengh<sup>2</sup>",
// hyphenation: ["mbanj", "cuengh"],
// syllableCount: 2,
// newBorNote: null
// }
convert("mbanjcuengh", "IPA"); // "/ɓaːn˨˦.ɕɯŋ˧˩/"
convert("mbanjcuengh", "old"); // "mbanzƨcɯŋ"
convert("mbanjcuengh", "tone numbers"); // "mbanj<sup>1</sup>cuengh<sup>2</sup>"
isLatin("mbanjcuengh"); // "y"
isLatin("壮语"); // ""API
show(text, newBor?)
Returns a PronInfo object with all representations at once.
| field | type | description |
|---|---|---|
| ipa | string | IPA transcription, wrapped in /…/ |
| toneNumbers | string | Latin spelling with HTML <sup> tone digits |
| hyphenation | string[] | One element per syllable |
| syllableCount | number | Length of hyphenation |
| newBorNote | string \| null | Set when newBor is provided |
convert(text, scheme, newBor?)
Returns a single string for the given scheme.scheme is one of "IPA" · "old" · "hyphenation" · "tone numbers".
("hyphenation" joins syllables with -.)
isLatin(text)
Returns "y" for New Zhuang Latin, "" for Old Zhuang script or Han characters.
Tones
| # | letter | contour | label | |---|---|---|---| | 1 | (none) | ˨˦ 24 | 阴平 | | 2 | z | ˧˩ 31 | 阳平 | | 3 | j | ˥ 55 | 上声 | | 4 | x | ˦˨ 42 | 去声 | | 5 | q | ˧˥ 35 | 阴入 | | 6 | h | ˧ 33 | 阳入 |
Syllables ending in -p/-t/-k are tone 7; -b/-d/-g are tone 8.
Mandarin borrowings (newBor) shift tone 1 → tone 5.
Internals
text
└─ segment() → Segment[] greedy longest-match tokeniser
└─ syllabify() → Syllable[] groups tokens into syllables
└─ Za.convert() → string | string[]All three are exported for testing.
