本文整理了Java中zemberek.morphology.analysis.WordAnalysis.stream()
方法的一些代码示例,展示了WordAnalysis.stream()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WordAnalysis.stream()
方法的具体详情如下:
包路径:zemberek.morphology.analysis.WordAnalysis
类名称:WordAnalysis
方法名:stream
暂无
代码示例来源:origin: ahmetaa/zemberek-nlp
WordAnalysisProto toWordAnalysisProto(WordAnalysis analysis) {
return WordAnalysisProto.newBuilder()
.addAllAnalyses(analysis
.stream()
.map(this::toSingleAnalysisProto)
.collect(Collectors.toList()))
.build();
}
代码示例来源:origin: ahmetaa/zemberek-nlp
/**
* Returns true if only word is analysed with internal dictionary and analysis dictionary item is
* not proper noun.
*/
boolean hasRegularAnalysis(String s) {
WordAnalysis a = morphology.analyze(s);
return a.stream().anyMatch(k -> !k.isUnknown() && !k.isRuntime() &&
k.getDictionaryItem().secondaryPos != SecondaryPos.ProperNoun &&
k.getDictionaryItem().secondaryPos != SecondaryPos.Abbreviation
);
}
代码示例来源:origin: ahmetaa/zemberek-nlp
Set<String> stems = wordResults.stream()
.map(a -> normalize(a.getDictionaryItem().lemma))
.collect(Collectors.toSet());
代码示例来源:origin: iorixxx/lucene-solr-analysis-turkish
private static List<SingleAnalysis> selectMorphemes(WordAnalysis results, String strategy) {
// if 0 or 1
if (results.analysisCount() < 2) return results.stream().collect(Collectors.toList());
switch (strategy) {
case "all":
return results.stream().collect(Collectors.toList());
case "maxMorpheme":
final int max = results.stream().map(morphParse -> morphParse.getMorphemeDataList().size()).max(Comparator.naturalOrder()).get();
return results.stream().filter(parse -> parse.getMorphemeDataList().size() == max).collect(Collectors.toList());
case "minMorpheme":
final int min = results.stream().map(morphParse -> morphParse.getMorphemeDataList().size()).min(Comparator.naturalOrder()).get();
return results.stream().filter(parse -> parse.getMorphemeDataList().size() == min).collect(Collectors.toList());
default:
throw new RuntimeException("unknown strategy " + strategy);
}
}
内容来源于网络,如有侵权,请联系作者删除!