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();
}
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();
}
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;
}
Aggregations