diff --git a/TransliterationAPI.UnitTests/Service/Transliterators/ArabicTransliteratorTests.cs b/TransliterationAPI.UnitTests/Service/Transliterators/ArabicTransliteratorTests.cs index 81570ab..28e00be 100644 --- a/TransliterationAPI.UnitTests/Service/Transliterators/ArabicTransliteratorTests.cs +++ b/TransliterationAPI.UnitTests/Service/Transliterators/ArabicTransliteratorTests.cs @@ -25,7 +25,9 @@ public void SetUp() [TestCase("روما", "Rūmā")] [TestCase("عَسْقَلَان", "ʿAsqalān")] [TestCase("فِلَسْطِينَ", "Filasṭīn")] + [TestCase("فهرج", "Fahraǧ")] [TestCase("هرتسليا", "Hirtsiliyā")] + [TestCase("يوانينا", "Īānīnā")] public void GivenATextInArabicScript_WhenTransliteratingIntoLatin_ThenTheCorrectTextIsReturned( string arabicText, string expectedTransliteratedText) diff --git a/TransliterationAPI/Service/TransliterationService.cs b/TransliterationAPI/Service/TransliterationService.cs index b73a730..6c5bd2b 100644 --- a/TransliterationAPI/Service/TransliterationService.cs +++ b/TransliterationAPI/Service/TransliterationService.cs @@ -95,6 +95,8 @@ async Task GetTransliteratedText(string text, string language) case "ady": // Adyghe return await translitterationDotComTransliterator.Transliterate(text, "ady", "iso-9"); case "ar": // Arabic + case "ary": // Maghrebi Arabic + case "arz": // Egyptian Arabic return arabicTransliterator.Transliterate(text); case "ba": // Bashkir return await translitterationDotComTransliterator.Transliterate(text, "bak", "iso-9"); diff --git a/TransliterationAPI/Service/Transliterators/ArabicTransliterator.cs b/TransliterationAPI/Service/Transliterators/ArabicTransliterator.cs index 278bf07..4351172 100644 --- a/TransliterationAPI/Service/Transliterators/ArabicTransliterator.cs +++ b/TransliterationAPI/Service/Transliterators/ArabicTransliterator.cs @@ -140,10 +140,12 @@ string ApplyFixes(string text) fixedText = fixedText.Replace("-r", "-R"); fixedText = Regex.Replace(fixedText, "([Ǧǧ])b", "$1ib"); + fixedText = Regex.Replace(fixedText, "([Īī])wā", "$1ā"); fixedText = Regex.Replace(fixedText, "([Nn])m", "$1im"); fixedText = Regex.Replace(fixedText, "([Qq])f", "$1if"); fixedText = Regex.Replace(fixedText, "Bā", "Ba"); fixedText = Regex.Replace(fixedText, "Dm", "Dim"); + fixedText = Regex.Replace(fixedText, "Fh", "Fah"); fixedText = Regex.Replace(fixedText, "Hr", "Hir"); fixedText = Regex.Replace(fixedText, "Is", "ʾIs"); fixedText = Regex.Replace(fixedText, "R([hm])", "Ra$1"); @@ -170,7 +172,7 @@ string ApplyFixes(string text) fixedText = Regex.Replace(fixedText, "lnd", "land"); fixedText = Regex.Replace(fixedText, "lẗ", "laḧ"); fixedText = Regex.Replace(fixedText, "mš", "maš"); - fixedText = Regex.Replace(fixedText, "rzn", "rzin"); + fixedText = Regex.Replace(fixedText, "rǧ", "raǧ"); fixedText = Regex.Replace(fixedText, "tsl", "tsil"); fixedText = Regex.Replace(fixedText, "rzn", "rzin");