mirror of https://github.com/apache/lucene.git
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:
parent
81d3ea17c7
commit
60c36c24fb
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue