Skip to content

Commit

Permalink
Improved greek transliteration
Browse files Browse the repository at this point in the history
  • Loading branch information
hmlendea committed Jan 26, 2022
1 parent c830a90 commit c8db73f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Service/Transliterators/TransliterateDotComTransliterator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ private string ApplyFixes(string text, string language)
fixedText = Regex.Replace(fixedText, "ō̂", "ô");

fixedText = Regex.Replace(fixedText, "Ch", "Kh");
fixedText = Regex.Replace(fixedText, "R([^\\s])", "Rh$1");

fixedText = Regex.Replace(fixedText, "ch", "kh");
fixedText = Regex.Replace(fixedText, "rh", "r");
fixedText = Regex.Replace(fixedText, "([^\\s])rh", "$1r");

fixedText = Regex.Replace(fixedText, "Mp", "V");
fixedText = Regex.Replace(fixedText, "Nk", "G");
Expand All @@ -59,6 +60,7 @@ private string ApplyFixes(string text, string language)
fixedText = Regex.Replace(fixedText, "([Rr])(a|ṓ)", "$1h$2");
fixedText = Regex.Replace(fixedText, "([Rr])h([a])", "$1$2");

fixedText = Regex.Replace(fixedText, "Agí(a|os)", "Hagí$1");
fixedText = Regex.Replace(fixedText, "polē$", "polis");
fixedText = Regex.Replace(fixedText, "polē ", "polis");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,17 @@ private string ApplyLanguageSpecificFixes(string text, string language)
fixedText = Regex.Replace(fixedText, "ήr([iíί])$", "éri");

fixedText = Regex.Replace(fixedText, "([a-zA-Z])H", "$1h");


fixedText = Regex.Replace(fixedText, "[Ά]", "Á");
fixedText = Regex.Replace(fixedText, "[Έ]", "É");
fixedText = Regex.Replace(fixedText, "[Ό]", "Ó");

fixedText = Regex.Replace(fixedText, "", "a");
fixedText = Regex.Replace(fixedText, "ά", "á");
fixedText = Regex.Replace(fixedText, "[έ]", "é");
fixedText = Regex.Replace(fixedText, "[ίή]", "í");
fixedText = Regex.Replace(fixedText, "ώ", "ó");
fixedText = Regex.Replace(fixedText, "[όώ]", "ó");
fixedText = Regex.Replace(fixedText, "ς", "s");
fixedText = Regex.Replace(fixedText, "ύ", "ú");

Expand Down

0 comments on commit c8db73f

Please sign in to comment.