List of usage examples for opennlp.tools.util StringUtil toLowerCase
public static String toLowerCase(CharSequence string)
From source file:com.condenast.nlp.opennlp.lemmatizer.SimpleLemmatizer.java
private List<String> getDictKeys(String word, String postag) { List<String> keys = new ArrayList<>(); if (constantTags.contains(postag)) { keys.addAll(Arrays.asList(word, postag)); } else {/*from w ww. j a v a2s . c o m*/ keys.addAll(Arrays.asList(StringUtil.toLowerCase(word), postag)); } return keys; }
From source file:com.condenast.nlp.opennlp.lemmatizer.SimpleLemmatizer.java
public String lemmatize(final String word, final String postag) { //String normWord = normalize(word); String lemma;//www. jav a 2s .c o m List<String> keys = getDictKeys(word, postag); String keyValue = dictMap.get(keys); if (keyValue != null) { lemma = keyValue; } else if (constantTags.contains(postag)) { lemma = word; } else if (word.toUpperCase().equals(word)) { lemma = word; } else { lemma = StringUtil.toLowerCase(word); } return lemma; }