Skip to content

Commit

Permalink
Merge pull request #13 from hmlendea/improvements
Browse files Browse the repository at this point in the history
Improved greek transliteration
  • Loading branch information
hmlendea authored Jan 26, 2022
2 parents bbbcbef + 5a81e4a commit d80aa25
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
12 changes: 11 additions & 1 deletion Service/Transliterators/TransliterateDotComTransliterator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,33 @@ 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");
fixedText = Regex.Replace(fixedText, "Nt", "D");
fixedText = Regex.Replace(fixedText, "([nrs])mp", "$1v");
fixedText = Regex.Replace(fixedText, "mp([aáioó])", "v$1");
fixedText = Regex.Replace(fixedText, "nknt", "gd");
fixedText = Regex.Replace(fixedText, "nnt", "ng");
fixedText = Regex.Replace(fixedText, "ntm", "dm");
fixedText = Regex.Replace(fixedText, "rnk", "rk");
fixedText = Regex.Replace(fixedText, "rnt", "rd");
fixedText = Regex.Replace(fixedText, "snt", "sht");
fixedText = Regex.Replace(fixedText, "([A-Za-z])'([A-Za-z])", "$1$2");
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");

fixedText = Regex.Replace(fixedText, "ín$", "ínon");
fixedText = Regex.Replace(fixedText, "o$", "on");

}
else if (language == "he")
{
Expand Down
11 changes: 10 additions & 1 deletion Service/Transliterators/TranslitterationDotComTransliterator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,24 @@ 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, "[όώ]", "ó");
fixedText = Regex.Replace(fixedText, "ς", "s");
fixedText = Regex.Replace(fixedText, "ύ", "ú");

fixedText = fixedText.Replace("Mp", "B");
fixedText = fixedText.Replace("Nt", "D");

fixedText = Regex.Replace(fixedText, "([r])nt", "$1d");
fixedText = Regex.Replace(fixedText, "([nrs])mp", "$1b");
}
Expand Down

0 comments on commit d80aa25

Please sign in to comment.