LUCENE-9782: Hunspell suggestions: split by space (but not dash) also before last char (#2387)

This commit is contained in:
Peter Gromov 2021-02-18 09:28:29 +01:00 committed by GitHub
parent f879c6ad84
commit 589eefc32b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 3 deletions

View File

@ -302,12 +302,12 @@ class ModifyingSuggester {
} }
private void trySplitting(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 w1 = word.substring(0, i);
String w2 = word.substring(i); String w2 = word.substring(i);
if (checkSimpleWord(w1) && checkSimpleWord(w2)) { if (checkSimpleWord(w1) && checkSimpleWord(w2)) {
result.add(w1 + " " + w2); result.add(w1 + " " + w2);
if (shouldSplitByDash()) { if (w1.length() > 1 && w2.length() > 1 && shouldSplitByDash()) {
result.add(w1 + "-" + w2); result.add(w1 + "-" + w2);
} }
} }

View File

@ -13,6 +13,7 @@
# switch off ngram suggestion for testing # switch off ngram suggestion for testing
MAXNGRAMSUGS 0 MAXNGRAMSUGS 0
TRY -
REP 2 REP 2
REP alot a_lot REP alot a_lot
REP inspite in_spite REP inspite in_spite

View File

@ -11,5 +11,5 @@ which
Gandhi Gandhi
McDonald McDonald
permanent permanent
in, in a

View File

@ -13,3 +13,4 @@ Mcdonald
permqnent permqnent
permanent-vacation permanent-vacation
permqnent-vacation permqnent-vacation
ina