Skip to content

Commit

Permalink
LUCENE-9782: Hunspell suggestions: split by space (but not dash) also…
Browse files Browse the repository at this point in the history
… before last char (apache#2387)
  • Loading branch information
donnerpeter authored Feb 18, 2021
1 parent f879c6a commit 589eefc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,12 @@ private List<String> checkDictionaryForSplitSuggestions(String word) {
}

private void trySplitting(String word) {
for (int i = 1; i < word.length() - 1; i++) {
for (int i = 1; i < word.length(); i++) {
String w1 = word.substring(0, i);
String w2 = word.substring(i);
if (checkSimpleWord(w1) && checkSimpleWord(w2)) {
result.add(w1 + " " + w2);
if (shouldSplitByDash()) {
if (w1.length() > 1 && w2.length() > 1 && shouldSplitByDash()) {
result.add(w1 + "-" + w2);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# switch off ngram suggestion for testing
MAXNGRAMSUGS 0
TRY -
REP 2
REP alot a_lot
REP inspite in_spite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ which
Gandhi
McDonald
permanent

in, in a

Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Mcdonald
permqnent
permanent-vacation
permqnent-vacation
ina

0 comments on commit 589eefc

Please sign in to comment.