Search in sources :

Example 6 with StemNode

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);
}
Also used : StemNode(zemberek.morphology.lexicon.graph.StemNode)

Aggregations

StemNode (zemberek.morphology.lexicon.graph.StemNode)6 PhoneticAttribute (zemberek.core.turkish.PhoneticAttribute)3 PhoneticExpectation (zemberek.core.turkish.PhoneticExpectation)3 SuffixData (zemberek.morphology.lexicon.graph.SuffixData)2 ArrayList (java.util.ArrayList)1 EnumSet (java.util.EnumSet)1 RootAttribute (zemberek.core.turkish.RootAttribute)1 TurkicLetter (zemberek.core.turkish.TurkicLetter)1 TurkishLetterSequence (zemberek.core.turkish.TurkishLetterSequence)1 LexiconException (zemberek.morphology.lexicon.LexiconException)1