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 2022/12/28 12:51:40 UTC

[GitHub] [lucene] rmuir commented on a diff in pull request #12044: some cleanup and refactoring codes of analysis-nori & analysis-kuromoji

rmuir commented on code in PR #12044:
URL: https://github.com/apache/lucene/pull/12044#discussion_r1058327418


##########
lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseBaseFormFilter.java:
##########
@@ -44,16 +44,18 @@ public JapaneseBaseFormFilter(TokenStream input) {
 
   @Override
   public boolean incrementToken() throws IOException {
-    if (input.incrementToken()) {
-      if (!keywordAtt.isKeyword()) {
-        String baseForm = basicFormAtt.getBaseForm();
-        if (baseForm != null) {
-          termAtt.setEmpty().append(baseForm);
-        }
-      }
-      return true;
-    } else {
+    if (input.incrementToken() == false) {
       return false;
     }
+
+    if (keywordAtt.isKeyword()) {
+      return true;
+    }
+
+    String baseForm = basicFormAtt.getBaseForm();
+    if (baseForm != null) {
+      termAtt.setEmpty().append(baseForm);
+    }
+    return true;

Review Comment:
   i don't understand the improvement here. it is clearer to be able to see the "decision tree" than to do multiple returns like this.



-- 
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-unsubscribe@lucene.apache.org

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