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

Gurmukhi transliteration: addressed overapplication of virama, normalized nukta characters #698

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
118 changes: 63 additions & 55 deletions rules/pa/pa-transliteration.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,35 @@
id: 'pa-transliteration',
name: 'Punjabi Transliteration',
description: 'Punjabi transliteration',
date: '2012-10-16',
date: '2022-08-28',
URL: 'http://github.com/wikimedia/jquery.ime',
author: 'Amir E. Aharoni, inputs from Saurabh Choudhary and Surinder Wadhawan',
author: 'Amir E. Aharoni, inputs from Saurabh Choudhary, Surinder Wadhawan, bgo_eiu',
license: 'GPLv3',
version: '1.0',
version: '2.0',
contextLength: 2,
maxKeyLength: 4,
/* Semi-automatically created from the Hindi transliteration mapping using
* the following Perl substitution:
* s{(?<deva_letter>[ऀ-ॿ])}{chr(ord($+{deva_letter}) + 0x100)}xmsge;
*/
patterns: [
[ 'ਕ੍h', 'c', 'ਚ੍' ],
[ 'ਕh', 'c', '' ],
[ '\\\\([A-Za-z\\>_~\\.0-9])', '\\\\', '$1' ],

// ਕ-ਹ is the main range of Indic letters.
// is an additional unique Gurmukhi letter.
[ '([ਕ-ਹੜ]਼?)੍a', '$1' ], // Short [a] after a consonant with virama removes the virama
[ '([ਕ-ਹੜ]਼?)੍A', '$1ਾ' ], // Long [a] after a consonant with virama removes the virama and adds long [a]
[ '([ਕ-ਹੜ]਼?)a', '$1ਾ' ], // 'aa' gives long [a] - short [a] after a consonant without virama adds long [a]
[ '([ਕ-ਹੜ]਼?)੍i', '$1ਿ' ],
[ '([ਕ-ਹੜ]਼?)(ਿi|੍I|ੇe)', '$1ੀ' ], // 'ii', 'I' and 'ee' give long [i].
[ '([ਕ-ਹੜ]਼?)੍u', '$1ੁ' ],
[ '([ਕ-ਹੜ]਼?)(ੁu|੍U|ੋo)', '$1ੂ' ], // 'uu', 'U' and 'oo' give long [u].
[ '([ਕ-ਹੜ]਼?)੍e', '$1ੇ' ],
[ '([ਕ-ਹੜ]਼?)(i|੍E)', '$1ੈ' ], // 'i' after a consonant without virama or 'E' after a consonant with Virama gives "ai"
[ '([ਕ-ਹੜ]਼?)੍[oO]', '$1ੋ' ],
[ '([ਕ-ਹੜ]਼?)u', '$1ੌ' ], // 'u' after a consonant without virama gives "au"
[ '([ਕ-ਹੜ])੍\\`', '$1਼੍' ], // '`' (backtick) after a consonant with virama adds a nukta before the virama
// ਖ਼, ਗ਼, ਜ਼, ੜ, ਫ਼ is are additional Gurmukhi letters.
[ '([ਕ-ਹਖ਼ਗ਼ਜ਼ੜਫ਼]਼?)', '$1' ],
[ '([ਕ-ਹਖ਼ਗ਼ਜ਼ੜਫ਼]਼?)a', '$1ਾ' ], // 'a' after a consonant adds long [a]
[ '([ਕ-ਹਖ਼ਗ਼ਜ਼ੜਫ਼]਼?)i', '$1ਿ' ],
[ '([ਕ-ਹਖ਼ਗ਼ਜ਼ੜਫ਼]਼?)(ਿi|I|ੇe)', '$1ੀ' ], // 'ii', 'I' and 'ee' give long [i].
[ '([ਕ-ਹਖ਼ਗ਼ਜ਼ੜਫ਼]਼?)u', '$1ੁ' ],
[ '([ਕ-ਹਖ਼ਗ਼ਜ਼ੜਫ਼]਼?)(ੁu|U|ੋo)', '$1ੂ' ], // 'uu', 'U' and 'oo' give long [u].
[ '([ਕ-ਹਖ਼ਗ਼ਜ਼ੜਫ਼]਼?)e', '$1ੇ' ],
[ '([ਕ-ਹਖ਼ਗ਼ਜ਼ੜਫ਼]਼?)E', '$1ੈ' ], // 'E' after a consonant gives "ai"
[ '([ਕ-ਹਖ਼ਗ਼ਜ਼ੜਫ਼]਼?)o', '$1ੋ' ],
[ '([ਕ-ਹਖ਼ਗ਼ਜ਼ੜਫ਼]਼?)O', '$1ੌ' ], // 'u' after a consonant gives "au"
[ '([ਕ-ਹਖ਼ਗ਼ਜ਼ੜਫ਼])~', '$1ੑ' ], // '~' after a consonant adds virama
[ '([ਕ-ਹਖ਼ਗ਼ਜ਼ੜਫ਼])੍\\`', '$1਼੍' ], // '`' (backtick) after a consonant with virama adds a nukta before the virama

[ 'ਅa', 'ਆ' ], // aa
[ '(ਓo|ਉu)', 'ਊ' ], // oo, uu
Expand All @@ -43,61 +43,68 @@
[ '(ਏe|ਇi)', 'ਈ' ], // ee, ii
[ 'ਅu', 'ਔ' ], // au
[ 'ਂ[Mm^]', 'ਁ' ], // bindi + 'm', 'M', or '^' -> Adak bindi
[ 'ਣ੍N', 'ੰ' ], // Tippi - nasalization
[ 'ਣN', 'ੰ' ], // Tippi - nasalization

[ 'ਕ੍h', 'ਖ੍' ], // kh
[ 'ਗ੍h', 'ਘ੍' ], // gh
[ 'ਨ੍g', 'ਙ੍' ], // ng
[ 'ਚ੍h', 'ਛ੍' ], // ch
[ 'ਜ੍h', 'ਝ੍' ], // jh
[ 'ਨ੍j', 'ਞ੍' ], // nj
[ 'ਟ੍h', 'ਠ੍' ], // Th
[ 'ਡ੍h', 'ਢ੍' ], // Dh
[ 'ਤ੍h', 'ਥ੍' ], // th
[ 'ਦ੍h', 'ਧ੍' ], // dh
[ 'ਪ੍h', 'ਫ੍' ], // ph
[ 'ਬ੍h', 'ਭ੍' ], // bh
[ 'ਕh', '' ], // kh
[ 'ਗh', '' ], // gh
[ 'ਨg', '' ], // ng
[ 'ਚh', '' ], // ch
[ 'ਜh', '' ], // jh
[ 'ਨj', '' ], // nj
[ 'ਟh', '' ], // Th
[ 'ਡh', '' ], // Dh
[ 'ਤh', '' ], // th
[ 'ਦh', '' ], // dh
[ 'ਪh', '' ], // ph
[ 'ਬh', '' ], // bh

[ 'ਸ੍h', 'ਸ਼੍' ], // sh
[ 'ਕ਼੍h', 'ਖ਼੍' ], // k + nukta + h
[ 'ਸh', '' ], // sh
[ 'ਕ਼h', '' ], // k + nukta + h

[ 'a', 'ਅ' ],
[ 'b', 'ਬ੍' ],
[ 'c', 'ਚ੍' ],
[ 'd', 'ਦ੍' ],
[ 'b', '' ],
[ 'c', '' ],
[ 'd', '' ],
[ 'e', 'ਏ' ],
[ 'f', 'ਫ੍' ],
[ 'F', 'ਫ਼੍' ], // With nukta
[ 'g', 'ਗ੍' ],
[ 'h', 'ਹ੍' ],
[ 'f', '' ],
[ 'F', '' ],
[ 'g', '' ],
[ 'h', '' ],
[ 'i', 'ਇ' ],
[ 'j', 'ਜ੍' ],
[ 'k', 'ਕ੍' ],
[ 'l', 'ਲ੍' ],
[ 'm', 'ਮ੍' ],
[ 'n', 'ਨ੍' ],
[ 'j', '' ],
[ 'k', '' ],
[ 'l', '' ],
[ 'm', '' ],
[ 'n', '' ],
[ 'o', 'ਓ' ],
[ 'p', 'ਪ੍' ],
[ 'q', '' ], // Udaat
[ 'r', 'ਰ੍' ],
[ 's', 'ਸ੍' ],
[ 't', 'ਤ੍' ],
[ 'p', '' ],
[ 'q', 'ਕ਼' ],
[ 'r', '' ],
[ 's', '' ],
[ 't', '' ],
[ 'u', 'ਉ' ],
[ '(v|w)', 'ਵ੍' ],
[ 'y', 'ਯ੍' ],
[ 'z', 'ੱ' ], // Addak - gemination
[ 'A', 'ਆ' ],
[ 'D', 'ਡ੍' ],
[ 'D', 'ਡ' ],
[ 'F', 'ਫ਼' ],
[ 'G', 'ਗ਼' ],
[ 'H', 'ਃ' ], // Visarga
[ 'I', 'ਈ' ],
[ 'J', 'ਜ਼' ],
[ 'K', 'ਖ਼' ],
[ 'L', 'ਲ਼'],
[ 'M', 'ਂ' ], // Bindi
[ 'N', 'ਣ੍' ],
[ 'R', 'ੜ੍' ], // Rra
[ 'S', 'ਸ਼੍' ],
[ 'T', 'ਟ੍' ],
[ 'N', 'ਣ' ],
[ 'Q', 'ੑ'], // Udaat
[ 'R', 'ੜ' ], // Rra
[ 'S', 'ਸ਼' ],
[ 'T', 'ਟ' ],
[ 'U', 'ਊ' ],
[ 'X', 'ੴ' ], // Ek onkar
[ 'Y', 'ੵ' ], // Yakash
[ 'Z', '.' ],
[ '0', '੦' ],
[ '1', '੧' ],
[ '2', '੨' ],
Expand All @@ -112,7 +119,8 @@
[ '\\`', '਼' ], // Nukta

[ '।\\.', '॥' ], // Double danda, must be before single danda
[ '\\.', '।' ] ] // Danda
[ '\\.', '।' ] // Danda
]
};

$.ime.register( paTransliteration );
Expand Down