protected static Hashtable<Character,String> ligatures_expansions_lower = new Hashtable<Character,String>();
protected static Hashtable<Character,String> ligatures_expansions = new Hashtable<Character,String>();
protected static Hashtable<String,Character> ligatures_contractions = new Hashtable<String,Character>();
+ private static boolean initialized = false;
public static void init() {
+ if (initialized)
+ return;
char_to_alternatives_lower.put('a', "àáâãäåāăą");
char_to_alternatives_lower.put('c', "çćĉċč");
char_to_alternatives_lower.put('d', "ďđ");
ligatures_expansions_lower.put('æ', "ae");
//ligatures_expansions_lower.put('ij', "ij"); buggy: see http://en.wikipedia.org/wiki/Typographic_ligature
ligatures_expansions_lower.put('œ', "oe");
+
e = ligatures_expansions_lower.keys();
while (e.hasMoreElements()) {
Character k = e.nextElement();
ligatures_expansions.put(Character.toUpperCase(k), uv);
ligatures_contractions.put(uv, Character.toUpperCase(k));
}
+
+ initialized = true;
}
public static String remove_decoration(String txt) {
+ init();
String result = "";
int len = txt.length();
char l;
}
public static String decorated_match_single_char(char c, boolean case_sensitive) {
+ init();
if (!case_sensitive)
c = Character.toLowerCase(c);
String result = "" + c;
}
public static String decorated_match(String txt, boolean case_sensitive) {
+ init();
String result = "";
txt = remove_decoration(txt);
if (!case_sensitive)
}
public static void main(String argv[]) {
- init();
String in = "Œuf";
System.out.println(in);
System.out.println(remove_decoration(in));
- System.out.println(decorated_match_single_char('m', true));
- System.out.println(decorated_match_single_char('m', false));
- System.out.println(decorated_match_single_char('h', true));
- System.out.println(decorated_match_single_char('h', false));
+ //System.out.println(decorated_match_single_char('m', true));
+ //System.out.println(decorated_match_single_char('m', false));
+ //System.out.println(decorated_match_single_char('h', true));
+ //System.out.println(decorated_match_single_char('h', false));
System.out.println(decorated_match(in, true));
System.out.println(decorated_match(in, false));
}