in jwnl-addon/src/main/java/opennlp/jwnl/lemmatizer/JWNLLemmatizer.java [62:94]
public JWNLLemmatizer(String wnDirectory) throws IOException {
super();
PointerType.initialize();
Adjective.initialize();
VerbFrame.initialize();
Map<POS, String[][]> suffixMap = new HashMap<>();
suffixMap.put(POS.NOUN, new String[][] { { "s", "" }, { "ses", "s" },
{ "xes", "x" }, { "zes", "z" }, { "ches", "ch" }, { "shes", "sh" },
{ "men", "man" }, { "ies", "y" } });
suffixMap.put(POS.VERB, new String[][] { { "s", "" }, { "ies", "y" },
{ "es", "e" }, { "es", "" }, { "ed", "e" }, { "ed", "" },
{ "ing", "e" }, { "ing", "" } });
suffixMap.put(POS.ADJECTIVE, new String[][] { { "er", "" }, { "est", "" },
{ "er", "e" }, { "est", "e" } });
DetachSuffixesOperation tokDso = new DetachSuffixesOperation(suffixMap);
tokDso.addDelegate(DetachSuffixesOperation.OPERATIONS, new Operation[] {
new LookupIndexWordOperation(), new LookupExceptionsOperation() });
TokenizerOperation tokOp = new TokenizerOperation(new String[] { " ", "-" });
tokOp.addDelegate(TokenizerOperation.TOKEN_OPERATIONS,
new Operation[] { new LookupIndexWordOperation(),
new LookupExceptionsOperation(), tokDso });
DetachSuffixesOperation morphDso = new DetachSuffixesOperation(suffixMap);
morphDso.addDelegate(DetachSuffixesOperation.OPERATIONS, new Operation[] {
new LookupIndexWordOperation(), new LookupExceptionsOperation() });
Operation[] operations = { new LookupExceptionsOperation(), morphDso, tokOp };
morphy = new DefaultMorphologicalProcessor(operations);
FileManager manager = new FileManagerImpl(wnDirectory,
PrincetonRandomAccessDictionaryFile.class);
FileDictionaryElementFactory factory = new PrincetonWN17FileDictionaryElementFactory();
FileBackedDictionary.install(manager, morphy, factory, true);
dict = net.didion.jwnl.dictionary.Dictionary.getInstance();
morphy = dict.getMorphologicalProcessor();
}