Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hokkien POJ: Ninth tone transliteration + tests #818

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 35 additions & 11 deletions rules/nan/nan-latn-pehoeji-transliteration.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
version: '1.0',
maxKeyLength: 4,
patterns: [
[ '((a|á|à|â|ã|ā)i?|(a|a̍)h)nn', '$1ⁿ' ],
[ '((a|á|à|â|ã|ā)i?|(a|a̍)h)nn', '$1ⁿ' ],
[ '(^|[^io])a(ⁿ|iⁿ?|m|ng?|u)?1', '$1a$2' ],
[ '(^|[^io])a(ⁿ|iⁿ?|m|ng?|u)?(2|\\\/)', '$1á$2' ],
[ '(^|[^io])a(ⁿ|iⁿ?|m|ng?|u)?(3|\\\\)', '$1à$2' ],
Expand All @@ -21,16 +21,19 @@
[ '(^|[^io])a(ⁿ|iⁿ?|m|ng?|u)?(6|~)', '$1ã$2' ],
[ '(^|[^io])a(ⁿ|iⁿ?|m|ng?|u)?(7|_)', '$1ā$2' ],
[ '(^|[^io])a(p|t|k|hⁿ?|uh)(8|\')', '$1a̍$2' ],
[ '(e|é|è|eh|ê|ẽ|ē|e̍h)?nn', '$1ⁿ' ],
[ '(^|[^io])a(p|t|k|hⁿ?|uh)9', '$1ă$2' ],
[ '(^|[^io])a(ⁿ|iⁿ?|m|ng?|u)?9', '$1ă$2' ],
[ '(e|é|è|eh|ê|ẽ|ē|e̍h|ĕ)?nn', '$1ⁿ' ],
[ '(^|[^o])e(ⁿ|ng)1', '$1e$2' ],
[ '(^|[^o])e(ⁿ|ng)(2|\\\/)', '$1é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@
[ 'm(6|~)', 'm̃' ],
[ 'm(7|_)', 'm̄' ],
[ 'mh(8|\')', 'm̍h' ],
[ '(^|[^aeo])ng1', '$1ng' ],
[ '(^|[^aeo])ng(2|\\\/)', '$1ńg' ],
[ '(^|[^aeo])ng(3|\\\\)', '$1ǹg' ],
[ 'm9', 'm̆'],
[ '(^|[^aeoAEO])ng1', '$1ng' ],
[ '(^|[^aeoAEO])ng(2|\\\/)', '$1ńg' ],
[ '(^|[^aeoAEO])ng(3|\\\\)', '$1ǹg' ],
[ 'n(g)?h4', 'n$1h' ],
[ '(^|[^aeo])ng(5|\\\^)', '$1n̂g' ],
[ '(^|[^aeo])ng(6|~)', '$1ñg' ],
[ '(^|[^aeo])ng(7|_)', '$1n̄g' ],
[ '(^|[^aeoAEO])ng(5|\\\^)', '$1n̂g' ],
[ '(^|[^aeoAEO])ng(6|~)', '$1ñg' ],
[ '(^|[^aeoAEO])ng(7|_)', '$1n̄g' ],
[ 'n(g)?h(8|\')', 'n̍$1h' ],
[ '(^|[^aeoI])ng9', '$1n̆g' ],
[ '(o(a|á|à|â|ã|ā|a̍)i|(o|ó|ò|ô|õ|ō)a?|(o|o̍)h)nn', '$1ⁿ' ],
[ '(^|[^i])oa(h|iⁿ?|ng?|t)?1', '$1oa$2' ],
[ '(^|[^i])o(ⁿ|aⁿ?|e|m|ng)?1', '$1o$2' ],
Expand Down Expand Up @@ -107,6 +120,7 @@
[ 'ōu', 'ō͘' ],
[ 'o͘h(8|\')', 'o̍͘h' ],
[ 'o̍u', 'o̍͘' ],
[ 'ŏu', 'ŏ͘' ],
[ '(^|[^ai])u(i|n)?1', '$1u$2' ],
[ '(^|[^ai])u(i|n)?(2|\\\/)', '$1ú$2' ],
[ '(^|[^ai])u(i|n)?(3|\\\\)', '$1ù$2' ],
Expand All @@ -129,7 +143,7 @@
[ '(^|[^o])E(ⁿ|ng)(2|\\\/)', '$1É$2' ],
[ '(^|[^o])E(ⁿ|ng)(3|\\\\)', '$1È$2' ],
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[ '(O(a|á|à|â|ã|ā|a̍)i|(O|Ó|Ò|Ô|Õ|Ō)a?|(O|O̍)h)nn', '$1ⁿ' ],
[ '(^|[^i])Oa(h|iⁿ?|ng?|t)?1', '$1Oa$2' ],
[ '(^|[^i])O(ⁿ|aⁿ?|e|m|ng)?1', '$1O$2' ],
Expand Down
27 changes: 26 additions & 1 deletion test/jquery.ime.test.fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -5157,7 +5157,32 @@ var palochkaVariants = {
{ input: 'ap\'', output: 'a̍p', description: 'Hokkien Pe̍h-ōe-jī a̍p' },
{ input: 'khoann3', output: 'khòaⁿ', description: 'Hokkien Pe̍h-ōe-jī khòaⁿ' },
{ input: 'khoai3', output: 'khoài', description: 'Hokkien Pe̍h-ōe-jī khoài' },
{ input: 'ouh8', output: 'o̍͘h', description: 'Hokkien Pe̍h-ōe-jī o̍͘h' }
{ input: 'ouh8', output: 'o̍͘h', description: 'Hokkien Pe̍h-ōe-jī o̍͘h' },
{ input: 'e5', output: 'ê', description: 'Hokkien Pe̍h-ōe-jī ê'},
{ input: 'eng2', output: 'éng', description: 'Hokkien Pe̍h-ōe-jī éng'},
// Ninth tone tests, taken from https://bitesizetaiwanese.com/ep06-the-ninth-tone/
// Japanese loanwords
{ input: 'ian9-jin2', output: 'iăn-jín', description: 'Hokkien Pe̍h-ōe-jī iăn-jín'},
{ input: 'lai9-lin2-guh4', output: 'lăi-lín-guh', description: 'Hokkien Pe̍h-ōe-jī lăi-lín-guh'},
{ input: 'khan9-bang2', output: 'khăn-báng', description: 'Hokkien Pe̍h-ōe-jī khăn-báng'},
{ input: 'lin9-jin2', output: 'lĭn-jín', description: 'Hokkien Pe̍h-ōe-jī lĭn-jín'},
{ input: 'han9-tou2-luh4', output: 'hăn-tó͘-luh', description: 'Hokkien Pe̍h-ōe-jī hăn-tó͘-luh'},
{ input: 'pha9-sian3-tou3', output: 'phă-siàn-tò͘', description: 'Hokkien Pe̍h-ōe-jī phă-siàn-tò͘'},
{ input: 'sam9-phu2-luh4', output: 'săm-phú-luh', description: 'Hokkien Pe̍h-ōe-jī săm-phú-luh'},
// Contractions
{ input: 'ing9', output: 'ĭng', description: 'Hokkien Pe̍h-ōe-jī ĭng'},
{ input: 'tsang9', output: 'tsăng', description: 'Hokkien Pe̍h-ōe-jī tsăng'},
{ input: 'tiong9', output: 'tiŏng', description: 'Hokkien Pe̍h-ōe-jī tiŏng'},
{ input: 'lai9', output: 'lăi', description: 'Hokkien Pe̍h-ōe-jī lăi'},
{ input: 'tann9', output: 'tăⁿ', description: 'Hokkien Pe̍h-ōe-jī tăⁿ'},
{ input: 'tsau9-kiann2', output: 'tsău-kiáⁿ', description: 'Hokkien Pe̍h-ōe-jī tsău-kiáⁿ'},
{ input: 'tsuan9', output: 'tsuăn', description: 'Hokkien Pe̍h-ōe-jī tsuăn'},
{ input: 'tsuann9', output: 'tsuăⁿ', description: 'Hokkien Pe̍h-ōe-jī tsuăⁿ'},
{ input: 'bua9-kin2', output: 'buă-kín', description: 'Hokkien Pe̍h-ōe-jī buă-kín'},
// Capitalization tests
{ input: 'E5', output: 'Ê', description: 'Hokkien Pe̍h-ōe-jī Ê'},
{ input: 'Ing9', output: 'Ĭng', description: 'Hokkien Pe̍h-ōe-jī Ĭng'},
{ input: 'Eng2', output: 'Éng', description: 'Hokkien Pe̍h-ōe-jī Éng'},
]
},
{
Expand Down
Loading