Search in sources :

Example 11 with StemTransition

use of zemberek.morphology.morphotactics.StemTransition in project zemberek-nlp by ahmetaa.

the class WordGenerator method generate.

public List<Result> generate(String stem, List<String> morphemeIds) {
    List<Morpheme> morphemes = new ArrayList<>();
    for (String morphemeId : morphemeIds) {
        Morpheme morpheme = TurkishMorphotactics.getMorpheme(morphemeId);
        morphemes.add(morpheme);
    }
    List<StemTransition> candidates = stemTransitions.getPrefixMatches(stem, false);
    return generate(stem, candidates, morphemes);
}
Also used : Morpheme(zemberek.morphology.morphotactics.Morpheme) StemTransition(zemberek.morphology.morphotactics.StemTransition) ArrayList(java.util.ArrayList)

Example 12 with StemTransition

use of zemberek.morphology.morphotactics.StemTransition in project zemberek-nlp by ahmetaa.

the class StemEndingGraph method generateStemGraph.

private CharacterGraph generateStemGraph() {
    CharacterGraph stemGraph = new CharacterGraph();
    StemTransitions stemTransitions = morphology.getMorphotactics().getStemTransitions();
    for (StemTransition transition : stemTransitions.getTransitions()) {
        if (transition.surface.length() == 0 || transition.item.primaryPos == PrimaryPos.Punctuation) {
            continue;
        }
        stemGraph.addWord(transition.surface, Node.TYPE_WORD);
    }
    return stemGraph;
}
Also used : StemTransition(zemberek.morphology.morphotactics.StemTransition) StemTransitions(zemberek.morphology.analysis.StemTransitions)

Aggregations

StemTransition (zemberek.morphology.morphotactics.StemTransition)12 ArrayList (java.util.ArrayList)4 PhoneticAttribute (zemberek.core.turkish.PhoneticAttribute)3 List (java.util.List)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 Assert (org.junit.Assert)2 Test (org.junit.Test)2 TestUtil (zemberek.core.io.TestUtil)2 DictionaryItem (zemberek.morphology.lexicon.DictionaryItem)2 RootLexicon (zemberek.morphology.lexicon.RootLexicon)2 TurkishDictionaryLoader (zemberek.morphology.lexicon.tr.TurkishDictionaryLoader)2 Morpheme (zemberek.morphology.morphotactics.Morpheme)2 MorphemeState (zemberek.morphology.morphotactics.MorphemeState)2 TurkishMorphotactics (zemberek.morphology.morphotactics.TurkishMorphotactics)2 RootAttribute (zemberek.core.turkish.RootAttribute)1 TurkicLetter (zemberek.core.turkish.TurkicLetter)1 AnalysisDebugData (zemberek.morphology.analysis.AnalysisDebugData)1 SearchPath (zemberek.morphology.analysis.SearchPath)1 SingleAnalysis (zemberek.morphology.analysis.SingleAnalysis)1