use of zemberek.morphology.lexicon.graph.StemNode in project zemberek-nlp by ahmetaa.
the class WordAnalyzer method dump.
public void dump(String input) {
// get stem candidates.
System.out.println(" Input:" + input);
List<StemNode> candidates = Lists.newArrayList();
for (int i = 1; i <= input.length(); i++) {
String stem = input.substring(0, i);
candidates.addAll(graph.getMatchingStemNodes(stem));
}
System.out.println(" Stem Nodes:");
for (StemNode candidate : candidates) {
System.out.println(candidate);
}
System.out.println(" Traverse Paths:");
// generate starting tokens with suffix root nodes.
List<Token> initialTokens = Lists.newArrayList();
for (StemNode candidate : candidates) {
String rest = input.substring(candidate.surfaceForm.length());
initialTokens.add(new Token(candidate, Lists.newArrayList(candidate.getSuffixRootSurfaceNode()), rest));
}
// traverse suffix graph.
List<WordAnalysis> result = Lists.newArrayList();
dumpTraverse(initialTokens, result);
}
Aggregations