Example usage for opennlp.tools.util StringUtil toLowerCase

List of usage examples for opennlp.tools.util StringUtil toLowerCase

Introduction

In this page you can find the example usage for opennlp.tools.util StringUtil toLowerCase.

Prototype

public static String toLowerCase(CharSequence string) 

Source Link

Document

Converts to lower case independent of the current locale via Character#toLowerCase(char) which uses mapping information from the UnicodeData file.

Usage

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;
}