(ngram) Fix index range in NgramLexicon to an avoid exception

This commit is contained in:
Viktor Lofgren 2024-04-12 10:13:25 +02:00
parent 65e3caf402
commit bb6b51ad91

View File

@ -80,7 +80,7 @@ public class NgramLexicon {
int ct = counts.get(ordered); int ct = counts.get(ordered);
if (ct > 0) { if (ct > 0) {
positions.add(Arrays.copyOfRange(parts, i - length, length)); positions.add(Arrays.copyOfRange(parts, i - length, i));
} }
if (i >= hashes.length) if (i >= hashes.length)