Java Examples for zemberek.morphology.parser.MorphParse

The following java examples will help you to understand the usage of zemberek.morphology.parser.MorphParse. These source code samples are taken from different open source projects.

Example 1
Project: lucene-solr-analysis-turkish-master  File: View source code
private static List<MorphParse> selectMorphemes(List<MorphParse> parses, String strategy) {
    // if 0 or 1
    if (parses.size() < 2)
        return parses;
    switch(strategy) {
        case "all":
            return parses;
        case "maxMorpheme":
            final int max = morphParse -> morphParse.inflectionalGroups.size()).max(Comparator.naturalOrder()).get();
            return parse -> parse.inflectionalGroups.size() == max).collect(Collectors.toList());
        case "minMorpheme":
            final int min = morphParse -> morphParse.inflectionalGroups.size()).min(Comparator.naturalOrder()).get();
            return parse -> parse.inflectionalGroups.size() == min).collect(Collectors.toList());
            throw new RuntimeException("unknown strategy " + strategy);