dweiss commented on a change in pull request #2286:
URL: https://github.com/apache/lucene-solr/pull/2286#discussion_r569570609



##########
File path: 
lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/ModifyingSuggester.java
##########
@@ -30,9 +32,52 @@
   }
 
   LinkedHashSet<String> suggest(String word) {
+    tryVariationsOf(word);
+
+    WordCase wc = WordCase.caseOf(word);
+
+    if (wc == WordCase.MIXED) {
+      int dot = word.indexOf('.');
+      if (dot > 0
+          && dot < word.length() - 1
+          && WordCase.caseOf(word.substring(dot + 1)) == WordCase.TITLE) {
+        result.add(word.substring(0, dot + 1) + " " + word.substring(dot + 1));
+      }
+
+      tryVariationsOf(toLowerCase(word));
+    }
+
+    return result;
+  }
+
+  private String toLowerCase(String word) {

Review comment:
       Ok, I looked at the entire code. Let's leave it for now - once we can 
pass all of hunspell's test cases perhaps there is a way to improve this. I'd 
love to see Java built-in locale mechanisms leveraged for doing some of the 
work here (like delegating letter case handling to Locale, replacing 
alternateCasing). 




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to