donnerpeter commented on a change in pull request #2260:
URL: https://github.com/apache/lucene-solr/pull/2260#discussion_r565908473
##########
File path:
lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Stemmer.java
##########
@@ -198,17 +251,35 @@ WordCase caseOf(char[] word, int length) {
true,
false,
false,
- caseVariant));
+ originalCase));
} catch (IOException bogus) {
throw new RuntimeException(bogus);
}
return stems;
}
- private boolean acceptCase(boolean caseVariant, char[] wordFlags) {
- return caseVariant
- ? !Dictionary.hasFlag(wordFlags, dictionary.keepcase)
- : !Dictionary.hasHiddenFlag(wordFlags);
+ private boolean acceptCase(
+ WordCase originalCase, char[] wordFlags, char[] word, int offset, int
length) {
+ boolean keepCase = Dictionary.hasFlag(wordFlags, dictionary.keepcase);
+ if (originalCase != null) {
+ if (keepCase
+ && dictionary.checkSharpS
+ && originalCase == WordCase.TITLE
+ && containsSharpS(word, offset, length)) {
+ return true;
+ }
+ return !keepCase;
+ }
+ return !Dictionary.hasHiddenFlag(wordFlags);
+ }
+
+ private boolean containsSharpS(char[] word, int offset, int length) {
+ for (int i = 0; i < length; i++) {
+ if (word[i + offset] == 'ß') {
Review comment:
...or `ArrayUtil.indexOf(char[] array, int start, int end, char toFind)`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]