don't let prefix's output bleed into full string's output (potential/latent bug)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1239658 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2012-02-02 15:01:13 +00:00
parent 81d3ea17c7
commit 60c36c24fb
2 changed files with 4 additions and 4 deletions

View File

@ -149,8 +149,8 @@ public final class UserDictionary implements Dictionary {
}
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;
}
}

View File

@ -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);