dungba88 commented on code in PR #12885: URL: https://github.com/apache/lucene/pull/12885#discussion_r1423365449
########## lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseReadingFormFilter.java: ########## @@ -43,10 +43,38 @@ public JapaneseReadingFormFilter(TokenStream input) { this(input, false); } + private boolean isHiragana(char ch) { + return ch >= 0x3041 && ch <= 0x3096; Review Comment: I think these can be extracted to constants for readability, e.g HIRAGANA_START, HIRAGANA_END ########## lucene/analysis/kuromoji/src/test/org/apache/lucene/analysis/ja/TestJapaneseReadingFormFilter.java: ########## @@ -88,6 +88,11 @@ protected TokenStreamComponents createComponents(String fieldName) { a.close(); } + public void testKatakanaReadingsHiragana() throws IOException { + assertAnalyzesTo( + katakanaAnalyzer, "が ぎ ぐ げ ご ぁ ゔ", new String[] {"ガ", "ギ", "グ", "ゲ", "ゴ", "ァ", "ヴ"}); Review Comment: I think we could add some test for half-width form as well? ########## lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseReadingFormFilter.java: ########## @@ -43,10 +43,38 @@ public JapaneseReadingFormFilter(TokenStream input) { this(input, false); } + private boolean isHiragana(char ch) { + return ch >= 0x3041 && ch <= 0x3096; + } + + private boolean containsHiragana(CharSequence s) { + int len = s.length(); + for (int i = 0; i < len; i++) { Review Comment: I think we can just use `i < s.length()`. It's also computed only once, and don't need an additional temporary variable. -- 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. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org 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