Skip to content

Commit

Permalink
Merge pull request #74 from hmlendea/arabic
Browse files Browse the repository at this point in the history
Improved transliteration for `Arabic`
  • Loading branch information
hmlendea authored Dec 6, 2023
2 parents 99676c9 + 8fbd65f commit 67cdc20
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public void SetUp()
[TestCase("روما", "Rūmā")]
[TestCase("رومان سور ديزير", "Rūmān al-Dīzīr")]
[TestCase("سُورِيَا", "Sūriyā")]
[TestCase("شنقيط", "Šinqīṭ")]
[TestCase("عَسْقَلَان", "ʿAsqalān")]
[TestCase("غَزَّة", "Ġazzah")]
[TestCase("فتح", "Fatḥ")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,21 @@ string ApplyFixes(string text)
fixedText = Regex.Replace(fixedText, @"([ -])ẖ", "$1H̱");

fixedText = Regex.Replace(fixedText, @"([Bb])([nr])", "$1a$2");
fixedText = Regex.Replace(fixedText, @"([Bb])([t])", "$1i$2");
fixedText = Regex.Replace(fixedText, @"([Bb])ū", "$1aū");
fixedText = Regex.Replace(fixedText, @"([Bb])ʾir", "$1iʾr");
fixedText = Regex.Replace(fixedText, @"([Ff])r", "$1ur");
fixedText = Regex.Replace(fixedText, @"([ǦJǧj])m", "$1um");
fixedText = Regex.Replace(fixedText, @"([HḤhḥ])([blmrsṣštṭ])", "$1a$2");
fixedText = Regex.Replace(fixedText, @"([KQkq])s", "$1as");
fixedText = Regex.Replace(fixedText, @"([Kk])w", "$1uw");
fixedText = Regex.Replace(fixedText, @"([LMlm])n", "$1an");
fixedText = Regex.Replace(fixedText, @"([LMlm])([ln])", "$1a$2");
fixedText = Regex.Replace(fixedText, @"([Mm])([sṣ])", "$1i$2");
fixedText = Regex.Replace(fixedText, @"([Mm])q", "$1uq");
fixedText = Regex.Replace(fixedText, @"([Rr])w", "$1ū");
fixedText = Regex.Replace(fixedText, @"([Ss])b", "$1ab");
fixedText = Regex.Replace(fixedText, @"([Šš])n", "$1in");
fixedText = Regex.Replace(fixedText, @"([Ṭṭ])l", "$1al");
fixedText = Regex.Replace(fixedText, @"āhٌ", "ah");
fixedText = Regex.Replace(fixedText, @"āšr\b", "āšir ");
fixedText = Regex.Replace(fixedText, @"āūm", "āwam");
Expand All @@ -232,6 +237,7 @@ string ApplyFixes(string text)
fixedText = Regex.Replace(fixedText, @"r([kǧ])", "ra$1");
fixedText = Regex.Replace(fixedText, @"shׂr", "sr");
fixedText = Regex.Replace(fixedText, @"sn", "san");
fixedText = Regex.Replace(fixedText, @"tl", "til");
fixedText = Regex.Replace(fixedText, @"tsl", "tsil");
fixedText = Regex.Replace(fixedText, @"un\b", "unn");
fixedText = Regex.Replace(fixedText, @"w([my])", "wa$1");
Expand All @@ -258,7 +264,7 @@ string ApplyFixes(string text)
fixedText = Regex.Replace(fixedText, @"[AĀaā]l-[Ss]([aā])", "as-S$1");
fixedText = Regex.Replace(fixedText, @"[AĀaā]l-ʿ[Aa]m", "al-ʿAm");

fixedText = Regex.Replace(fixedText, @"Abū", "Abu");
fixedText = Regex.Replace(fixedText, @"Ab[a]*ū", "Abu");
fixedText = Regex.Replace(fixedText, @"Mīdīnā", "Madīnā");

fixedText = Regex.Replace(fixedText, @"([a-z])([A-Z])", "$1 $2");
Expand Down

0 comments on commit 67cdc20

Please sign in to comment.