LUCENE-9764: Hunspell: try title case as FORCEUCASE misspelled word suggestions (#2352)

This commit is contained in:
Peter Gromov 2021-02-11 15:12:58 +01:00 committed by GitHub
parent 7f9b1f991b
commit 01e34f8723
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -430,6 +430,13 @@ public class SpellChecker {
}
WordCase wordCase = WordCase.caseOf(word);
if (dictionary.forceUCase != FLAG_UNSET && wordCase == WordCase.LOWER) {
String title = dictionary.toTitleCase(word);
if (spell(title)) {
return Collections.singletonList(title);
}
}
SpellChecker suggestionSpeller =
new SpellChecker(dictionary) {
@Override

View File

@ -0,0 +1,2 @@
Foobaz
Foobarbaz