Search in sources :

Example 6 with WordTag

use of edu.stanford.nlp.ling.WordTag in project CoreNLP by stanfordnlp.

the class CollocationFinder method treeAsStemmedCollocation.

private static String treeAsStemmedCollocation(Tree t) {
    List<WordTag> list = getStemmedWordTagsFromTree(t);
    // err.println(list.size());
    StringBuilder s = new StringBuilder(160);
    WordTag firstWord = list.remove(0);
    s.append(firstWord.word());
    for (WordTag wt : list) {
        s.append("_");
        s.append(wt.word());
    }
    //err.println("Expressing this as:"+s.toString());
    return s.toString();
}
Also used : WordTag(edu.stanford.nlp.ling.WordTag)

Example 7 with WordTag

use of edu.stanford.nlp.ling.WordTag in project CoreNLP by stanfordnlp.

the class CollocationFinder method treeAsNonStemmedCollocation.

private static String treeAsNonStemmedCollocation(Tree t) {
    List<WordTag> list = getNonStemmedWordTagsFromTree(t);
    StringBuilder s = new StringBuilder(160);
    WordTag firstWord = list.remove(0);
    s.append(firstWord.word());
    for (WordTag wt : list) {
        s.append('_');
        s.append(wt.word());
    }
    return s.toString();
}
Also used : WordTag(edu.stanford.nlp.ling.WordTag)

Example 8 with WordTag

use of edu.stanford.nlp.ling.WordTag in project CoreNLP by stanfordnlp.

the class CollocationFinder method getNonStemmedWordTagsFromTree.

private static List<WordTag> getNonStemmedWordTagsFromTree(Tree t) {
    List<WordTag> wordTags = Generics.newArrayList();
    ArrayList<TaggedWord> s = t.taggedYield();
    for (TaggedWord w : s) {
        WordTag wt = new WordTag(w.word(), w.tag());
        wordTags.add(wt);
    }
    return wordTags;
}
Also used : TaggedWord(edu.stanford.nlp.ling.TaggedWord) WordTag(edu.stanford.nlp.ling.WordTag)

Aggregations

WordTag (edu.stanford.nlp.ling.WordTag)8 TaggedWord (edu.stanford.nlp.ling.TaggedWord)4 Word (edu.stanford.nlp.ling.Word)1 ClassicCounter (edu.stanford.nlp.stats.ClassicCounter)1 ArrayList (java.util.ArrayList)1