You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/02/03 08:35:48 UTC

[GitHub] [lucene-solr] donnerpeter commented on a change in pull request #2286: LUCENE-9720: Hunspell: more ways to vary misspelled word variations f…

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



##########
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:
       `CharacterUtils` seems to have something similar. I haven't yet seen the need for code point support though, Hunspell uses UTF-16 internally which should fit Java strings unless I'm missing something.
   
   This conversion is locale-dependent: it honors at least tr/az languages in `Dictionary.caseFold`.




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



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