-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed 咖啡 transliteration for Singapore dialect, fixed error with brow…
…ser import of the library, minor edits to words and vars datasets
- Loading branch information
Showing
6 changed files
with
84 additions
and
31 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,5 +42,6 @@ | |
"譁": "嘩", | ||
"廕": "蔭", | ||
"鍾": "鐘", | ||
"歎": "嘆" | ||
"歎": "嘆", | ||
"儂": "人" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
const { Converter } = require('taibun'); | ||
|
||
test('tones', () => { | ||
const c = new Converter({ system: 'IPA', dialect: "Singapore", punctuation: 'none' }); | ||
const tones = { '衫': 'sã⁴⁴', '短': 'te⁴²', '褲': 'kʰɔ²¹', '闊': 'kʰuaʔ³²', '人': 'laŋ²⁴', '鼻': 'pʰĩ²²', '直': 'tit̚⁴' }; | ||
for (let [tone, expected] of Object.entries(tones)) { | ||
expect(c.get(tone)).toBe(expected); | ||
} | ||
}); | ||
|
||
test('o conversion', () => { | ||
const c = new Converter({ system: 'IPA', dialect: "Singapore", punctuation: 'none' }); | ||
const oWords = { '高': 'ko⁴⁴', '唔': 'ɔ̃⁴⁴', '烏': 'ɔ⁴⁴', '王': 'ɔŋ²⁴' }; | ||
for (let [word, expected] of Object.entries(oWords)) { | ||
expect(c.get(word)).toBe(expected); | ||
} | ||
}); | ||
|
||
describe('eng conversion', () => { | ||
const hanjiData = ['用', '冰', '兵', '幸啊', '無閒', '無政府']; | ||
const testData = [ | ||
[['ēng', 'peng', 'peng', 'hēng--ah', 'bô-êng', 'bô tsèng-hú'], "Tailo"], | ||
[['ēng', 'peng', 'peng', 'hēng--ah', 'bô-êng', 'bô chèng-hú'], "POJ"], | ||
[['ㆤㄥ˫', 'ㄅㆤㄥ', 'ㄅㆤㄥ', 'ㄏㆤㄥ˫ ㄚ', 'ㆠㄜˊ ㆤㄥˊ', 'ㆠㄜˊ ㄗㆤㄥ˪ ㄏㄨˋ'], "Zhuyin"], | ||
[['eng7', 'peng1', 'peng1', 'heng7 ah0', 'bo5 eng5', 'bo5 ceng3 hu2'], "TLPA"], | ||
[['êng', 'bēng', 'bēng', 'hêng ah', 'bbóéng', 'bbó zènghǔ'], "Pingyim"], | ||
[['ēng', 'beng', 'beng', 'hēng--åh', 'bhôr-ĕng', 'bhôr zèng-hù'], "Tongiong"], | ||
[['eŋ²²', 'peŋ⁴⁴', 'peŋ⁴⁴', 'heŋ²² a', 'bo²⁴ eŋ²⁴', 'bo²⁴ tseŋ²¹ hu⁴²'], "IPA"] | ||
]; | ||
testData.forEach(([transl, system]) => { | ||
const data = hanjiData.map((h, i) => [h, transl[i]]); | ||
test(`testing: ${system}`, () => { | ||
const c = new Converter({ system, dialect: "Singapore", punctuation: 'none' }); | ||
data.forEach(([hanji, expected]) => { expect(c.get(hanji)).toBe(expected); }); | ||
}); | ||
}); | ||
}); | ||
|
||
test('sandhi', () => { | ||
const sandhis = ['auto', 'none', 'excLast', 'inclLast']; | ||
const expectedResults = ['Tài-uân', 'Tâi-uân', 'Tài-uân', 'Tài-uàn']; | ||
|
||
sandhis.forEach((sandhi, index) => { | ||
const c = new Converter({ dialect: "Singapore", punctuation: "none", sandhi }); | ||
expect(c.get('台灣')).toBe(expectedResults[index]); | ||
}); | ||
}); | ||
|
||
test('kopi', () => { | ||
const c = new Converter({ dialect: "Singapore", punctuation: 'none' }); | ||
const kos = ['咖啡', '烏咖啡', '咖啡杯', '咖哩', '咖咖仔']; | ||
const expectedResults = ['ko-pi', 'oo-ko-pi', 'ko-pi-pue', 'ka-lí', 'ka-ka-á']; | ||
|
||
kos.forEach((ko, index) => { | ||
expect(c.get(ko)).toBe(expectedResults[index]); | ||
}); | ||
}); |