static { if (Reflect.available(PATTERN, "German")) { for (final Language l : Language.ALL.values()) { final Class<?> clz = Reflect.find(PATTERN, l); if (clz == null) continue; final Method m1 = Reflect.method(clz, "setCurrent", String.class); final Method m2 = Reflect.method(clz, "stem"); final Method m3 = Reflect.method(clz, "getCurrent"); if (m1 == null || m2 == null || m3 == null) { Util.errln("Could not initialize \"%\" Snowball stemmer.", l); } else { CLASSES.put(l, new StemmerClass(clz, m1, m2, m3)); } } } }
static { IOFile dic = null; if (Reflect.available(PATTERN)) { dic = new IOFile(LANG); if (!dic.exists()) { dic = new IOFile(Prop.HOME, "etc/" + LANG); if (!dic.exists()) { available = false; } } } else { available = false; } if (available) { Class<?> clz = Reflect.find(PATTERN); if (clz == null) { Util.debug("Could not initialize Igo Japanese lexer."); } else { /* Igo constructor. */ final Constructor<?> tgr = Reflect.find(clz, String.class); tagger = Reflect.get(tgr, dic.path()); if (tagger == null) { available = false; Util.debug("Could not initialize Igo Japanese lexer."); } else { parse = Reflect.method(clz, "parse", CharSequence.class); if (parse == null) { Util.debug("Could not initialize Igo lexer method."); } clz = Reflect.find("net.reduls.igo.Morpheme"); surface = Reflect.field(clz, "surface"); feature = Reflect.field(clz, "feature"); start = Reflect.field(clz, "start"); } } } }