Beautified code and added Normalized word functionality on OneWords
This commit is contained in:
@@ -892,7 +892,7 @@ public class XML_processing {
|
||||
if (filter.getAl() == AnalysisLevel.STRING_LEVEL) {
|
||||
// ngram level: if not 0 must be less than or equal to number of words in this sentence.
|
||||
if (filter.getNgramValue() > 0 && filter.getNgramValue() > sentence.size()) {
|
||||
return null;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// if we're calculating values for letters, omit words that are shorter than string length
|
||||
|
||||
@@ -56,7 +56,8 @@ public class Ngrams {
|
||||
// String test = key;
|
||||
// }
|
||||
|
||||
// key = (!key.equals("") && key.charAt(key.length()-1) == ',') ? key.substring(0, key.length() - 1) : key;
|
||||
if (stats.getFilter().getNotePunctuations())
|
||||
key = (!key.equals("") && key.charAt(key.length()-1) == ',') ? key.substring(0, key.length() - 1) : key;
|
||||
|
||||
MultipleHMKeys multipleKeys;
|
||||
|
||||
@@ -165,6 +166,12 @@ public class Ngrams {
|
||||
// .collect(Collectors.toList()));
|
||||
// .substring(0, 1)
|
||||
return StringUtils.join(candidate, " ");
|
||||
case NORMALIZED_WORD:
|
||||
candidate.addAll(ngramCandidate
|
||||
.stream()
|
||||
.map(Word::getNormalizedWord)
|
||||
.collect(Collectors.toList()));
|
||||
return StringUtils.join(candidate, " ");
|
||||
}
|
||||
|
||||
return StringUtils.join(candidate, " ");
|
||||
|
||||
Reference in New Issue
Block a user