You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/02/02 16:03:16 UTC

svn commit: r1239660 - in /lucene/dev/branches/branch_3x: ./ lucene/ lucene/contrib/analyzers/kuromoji/ lucene/contrib/analyzers/kuromoji/src/java/org/apache/lucene/analysis/kuromoji/dict/ lucene/contrib/analyzers/kuromoji/src/java/org/apache/lucene/an...

Author: mikemccand
Date: Thu Feb  2 15:03:15 2012
New Revision: 1239660

URL: http://svn.apache.org/viewvc?rev=1239660&view=rev
Log:
don't let prefix's output bleed into full string's output (potential/latent bug)

Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/   (props changed)
    lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/   (props changed)
    lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/src/java/org/apache/lucene/analysis/kuromoji/dict/UserDictionary.java
    lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/src/java/org/apache/lucene/analysis/kuromoji/viterbi/Viterbi.java
    lucene/dev/branches/branch_3x/solr/   (props changed)
    lucene/dev/branches/branch_3x/solr/core/   (props changed)

Modified: lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/src/java/org/apache/lucene/analysis/kuromoji/dict/UserDictionary.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/src/java/org/apache/lucene/analysis/kuromoji/dict/UserDictionary.java?rev=1239660&r1=1239659&r2=1239660&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/src/java/org/apache/lucene/analysis/kuromoji/dict/UserDictionary.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/src/java/org/apache/lucene/analysis/kuromoji/dict/UserDictionary.java Thu Feb  2 15:03:15 2012
@@ -149,8 +149,8 @@ public final class UserDictionary implem
         }
         output += arc.output.intValue();
         if (arc.isFinal()) {
-          output += arc.nextFinalOutput.intValue();
-          result.put(startOffset-off, segmentations[output]);
+          final int finalOutput = output + arc.nextFinalOutput.intValue();
+          result.put(startOffset-off, segmentations[finalOutput]);
           found = true;
         }
       }

Modified: lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/src/java/org/apache/lucene/analysis/kuromoji/viterbi/Viterbi.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/src/java/org/apache/lucene/analysis/kuromoji/viterbi/Viterbi.java?rev=1239660&r1=1239659&r2=1239660&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/src/java/org/apache/lucene/analysis/kuromoji/viterbi/Viterbi.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/src/java/org/apache/lucene/analysis/kuromoji/viterbi/Viterbi.java Thu Feb  2 15:03:15 2012
@@ -248,9 +248,9 @@ public class Viterbi {
         output += arc.output.intValue();
 
         if (arc.isFinal()) {
-          output += arc.nextFinalOutput.intValue();
+          final int finalOutput = output + arc.nextFinalOutput.intValue();
           found = true; // Don't produce unknown word starting from this index
-          dictionary.lookupWordIds(output, wordIdRef);
+          dictionary.lookupWordIds(finalOutput, wordIdRef);
           for (int ofs = 0; ofs < wordIdRef.length; ofs++) {
             final int wordId = wordIdRef.ints[wordIdRef.offset + ofs];
             ViterbiNode node = new ViterbiNode(wordId, text, suffixStart, endIndex, dictionary.getLeftId(wordId), dictionary.getRightId(wordId), dictionary.getWordCost(wordId), startIndex, Type.KNOWN);