Skip to content

Commit

Permalink
return null when score is above 90000000
Browse files Browse the repository at this point in the history
  • Loading branch information
austin007008 committed Jul 9, 2024
1 parent fd9a3f5 commit f9eb209
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public boolean addTerm(String word, List<String> hitTermsList) {
scores.add(-1); // add the default score to its array
if (arrSize > 1) { // if this is at least the second word we are adding...
if ((hitTermsList != null) && hitTermsList.contains(word)) { // if this word is a hit term...
if (hitTermIndex == -1) { // if we don't have a hit term at this offset yet..
if (hitTermIndex == -1) { // if we don't have a hit term at this offset yet...
hitTermIndex = arrSize - 1; // set this index as the one with a hit term
hasHitTerm = true;
} else {
Expand Down Expand Up @@ -172,6 +172,9 @@ public String getWordToOutput() {
return "REPORTMETODATAWAVE";
} else {
if (oneBestExcerpt) {
if(scores.get(smallestScoreIndex) > 90000000) {
return null;
}
if (STOP_WORD_LIST.contains(words.get(smallestScoreIndex))) { // if the selected term is in the stop list...
return null;
}
Expand All @@ -182,6 +185,9 @@ public String getWordToOutput() {
}
}
if (overrideIndex >= 0 && overrideIndex < arrSize) {
if(scores.get(overrideIndex) > 90000000) {
return null;
}
if (STOP_WORD_LIST.contains(words.get(overrideIndex))) { // if the hit term is on the stop list for some reason...
return null;
}
Expand Down Expand Up @@ -210,6 +216,9 @@ public String getWordToOutput() {
}
}
if (hasHitTerm) { // if we have a hit term...
if(scores.get(hitTermIndex) > 90000000) {
return null;
}
if (STOP_WORD_LIST.contains(words.get(hitTermIndex))) { // if the hit term is on the stop list for some reason...
return null;
}
Expand All @@ -220,6 +229,9 @@ public String getWordToOutput() {
}
}
if (useScores) { // if we have added at least one score, and it is a valid score...
if(scores.get(smallestScoreIndex) > 90000000) {
return null;
}
if (STOP_WORD_LIST.contains(words.get(smallestScoreIndex))) { // if the selected term is in the stop list...
return null;
}
Expand Down

0 comments on commit f9eb209

Please sign in to comment.