Back to project page brainrot.
The source code is released under:
Apache License
If you think the Android project brainrot listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package jcuenod.brainrot; /*from w w w . j a va2 s .co m*/ import java.text.Normalizer; import java.text.Normalizer.Form; import java.util.HashMap; import java.util.Map; import android.util.Log; public class LanguageUtils { private static String LOG_TAG = "BrainRot LangU"; public static String normalize (String denormalised) { return Normalizer.normalize(denormalised, Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", ""); } public static String transliterate (String unicodeStr) { String ret = unicodeStr; for (Map.Entry<String, String> entry : getTransliterationHash().entrySet()) { ret = ret.replace(entry.getKey(), entry.getValue()); } return ret; } public static String domagic (String denormalised) { return LanguageUtils.transliterate(LanguageUtils.normalize(denormalised)); } private static Map<String, String> getTransliterationHash() { Map<String, String> hash = new HashMap<String, String>(); hash.put("?", "a"); hash.put("?", "b"); hash.put("?", "g"); hash.put("?", "d"); hash.put("?", "e"); hash.put("?", "z"); hash.put("?", "e"); hash.put("?", "th"); hash.put("?", "i"); hash.put("?", "k"); hash.put("?", "l"); hash.put("?", "m"); hash.put("?", "n"); hash.put("?", "x"); hash.put("?", "o"); hash.put("?", "p"); hash.put("??", "r"); hash.put("?", "s"); hash.put("?", "s"); hash.put("?", "t"); hash.put("?", "u"); hash.put("?", "ph"); hash.put("?", "ch"); hash.put("?", "ps"); hash.put("?", "o"); hash.put("?", "a"); hash.put("?", "b"); hash.put("?", "g"); hash.put("?", "d"); hash.put("?", "e"); hash.put("?", "z"); hash.put("?", "e"); hash.put("?", "th"); hash.put("?", "i"); hash.put("?", "k"); hash.put("?", "l"); hash.put("?", "m"); hash.put("??", "n"); hash.put("?", "x"); hash.put("?", "o"); hash.put("?", "p"); hash.put("?", "r"); hash.put("?", "s"); hash.put("?", "s"); hash.put("?", "t"); hash.put("?", "u"); hash.put("?", "ph"); hash.put("?", "ch"); hash.put("?", "ps"); hash.put("?", "o"); return hash; } }