mirror of https://github.com/apache/lucene.git
LUCENE-9782: Hunspell suggestions: split by space (but not dash) also before last char (#2387)
This commit is contained in:
parent
f879c6ad84
commit
589eefc32b
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -11,5 +11,5 @@ which
|
||||||
Gandhi
|
Gandhi
|
||||||
McDonald
|
McDonald
|
||||||
permanent
|
permanent
|
||||||
|
in, in a
|
||||||
|
|
||||||
|
|
|
@ -13,3 +13,4 @@ Mcdonald
|
||||||
permqnent
|
permqnent
|
||||||
permanent-vacation
|
permanent-vacation
|
||||||
permqnent-vacation
|
permqnent-vacation
|
||||||
|
ina
|
Loading…
Reference in New Issue