本文整理了Java中zemberek.core.collections.Histogram.removeSmaller()
方法的一些代码示例,展示了Histogram.removeSmaller()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Histogram.removeSmaller()
方法的具体详情如下:
包路径:zemberek.core.collections.Histogram
类名称:Histogram
方法名:removeSmaller
[英]removes the items that has a count smaller than minCount
[中]删除计数小于minCount的项目
代码示例来源:origin: ahmetaa/zemberek-nlp
public int removeSmaller(int order, int size) {
return gramCounts[order].removeSmaller(size);
}
代码示例来源:origin: ahmetaa/zemberek-nlp
NormalizationVocabulary(
Path correct,
Path incorrect,
Path maybeIncorrect,
int correctMinCount,
int incorrectMinCount,
int maybeIncorrectMinCount) throws IOException {
Histogram<String> correctWords = Histogram.loadFromUtf8File(correct, ' ');
Histogram<String> noisyWords = Histogram.loadFromUtf8File(incorrect, ' ');
Histogram<String> maybeIncorrectWords = new Histogram<>();
if (maybeIncorrect != null) {
maybeIncorrectWords = Histogram.loadFromUtf8File(maybeIncorrect, ' ');
}
correctWords.removeSmaller(correctMinCount);
noisyWords.removeSmaller(incorrectMinCount);
maybeIncorrectWords.removeSmaller(maybeIncorrectMinCount);
this.noisyWordStart = correctWords.size();
this.words = new ArrayList<>(correctWords.getSortedList());
words.addAll(noisyWords.getSortedList());
this.maybeIncorrectWordStart = words.size();
words.addAll(maybeIncorrectWords.getSortedList());
int i = 0;
for (String word : words) {
indexes.put(word, i);
i++;
}
}
代码示例来源:origin: ahmetaa/zemberek-nlp
parseFails.removeSmaller(3);
parseFails.saveSortedByCounts(Paths.get("parse-fails.txt"), " ");
代码示例来源:origin: ahmetaa/zemberek-nlp
Log.info("%d words loaded.", wordFreq.size());
wordFreq.removeSmaller(minWordCount);
if (minWordCount > 1) {
Log.info("%d words left after removing counts less than %d.",
代码示例来源:origin: ahmetaa/zemberek-nlp
Histogram<String> incorrectFromNoisy = Histogram
.loadFromUtf8File(noisyRoot.resolve("incorrect"), ' ');
incorrectFromNoisy.removeSmaller(2);
代码示例来源:origin: ahmetaa/zemberek-nlp
public static void counts() {
String[] fruits = {"apple", "pear", "grape", "apple", "apple", "apricot", "grape"};
Log.info("Adding elements to histogram:" + Arrays.toString(fruits));
Histogram<String> histogram = new Histogram<>();
histogram.add(fruits);
Log.info("\nPrint with no order");
for (String s : histogram) {
Log.info(s + " count: " + histogram.getCount(s));
}
Log.info("\nPrint with count order");
for (String s : histogram.getSortedList()) {
Log.info(s + " count: " + histogram.getCount(s));
}
histogram.removeSmaller(2);
Log.info("\nAfter removing elements with counts less than 2");
for (String s : histogram.getSortedList()) {
Log.info(s + " count: " + histogram.getCount(s));
}
}
代码示例来源:origin: ahmetaa/turkish-nlp-examples
public static void counts() {
String[] fruits = {"apple", "pear", "grape", "apple", "apple", "apricot", "grape"};
Log.info("Adding elements to histogram:" + Arrays.toString(fruits));
Histogram<String> histogram = new Histogram<>();
histogram.add(fruits);
Log.info("\nPrint with no order");
for (String s : histogram) {
Log.info(s + " count: " + histogram.getCount(s));
}
Log.info("\nPrint with count order");
for (String s : histogram.getSortedList()) {
Log.info(s + " count: " + histogram.getCount(s));
}
histogram.removeSmaller(2);
Log.info("\nAfter removing elements with counts less than 2");
for (String s : histogram.getSortedList()) {
Log.info(s + " count: " + histogram.getCount(s));
}
}
内容来源于网络,如有侵权,请联系作者删除!