You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by GitBox <gi...@apache.org> on 2019/03/06 09:50:26 UTC

[GitHub] [lucene-solr] jimczi commented on a change in pull request #576: LUCENE-8631: Longest-Matching for User words in Nori Tokenizer

jimczi commented on a change in pull request #576: LUCENE-8631: Longest-Matching for User words in Nori Tokenizer
URL: https://github.com/apache/lucene-solr/pull/576#discussion_r262863030
 
 

 ##########
 File path: lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanTokenizer.java
 ##########
 @@ -651,20 +662,37 @@ private void parse() throws IOException {
       if (userFST != null) {
         userFST.getFirstArc(arc);
         int output = 0;
+        int posAheadMax = 0;
+        int output_posAheadMax = 0;
+        int arcFinalOut_posAheadMax = 0;
+
         for(int posAhead=pos;;posAhead++) {
           final int ch = buffer.get(posAhead);
-          if (ch == -1) {
-            break;
-          }
-          if (userFST.findTargetArc(ch, arc, arc, posAhead == pos, userFSTReader) == null) {
-            break;
+          if (ch == -1 || userFST.findTargetArc(ch, arc, arc, posAhead == pos, userFSTReader) == null) {
+            if (anyMatches
+              && posAheadMax > global_posAheadMax) {
 
 Review comment:
   What are you trying to avoid with this check ? We should always add the longest dictionary term, no ?

----------------------------------------------------------------
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


With regards,
Apache Git Services

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