Skip to content

Commit 52af2e9

Browse files
committed
Consistently return (ngram, index) from indexers.
1 parent 79be265 commit 52af2e9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/finalfusion/subword/hash_indexers.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ cdef class FinalfusionHashIndexer:
137137
if j + i <= length:
138138
h = (fifu_hash_ngram(word, i, j) & self.mask) + offset
139139
if with_ngrams:
140-
ngrams.append((h, word[i:i + j]))
140+
ngrams.append((word[i:i + j], h))
141141
else:
142142
ngrams.append(h)
143143
return ngrams
@@ -269,7 +269,7 @@ cdef class FastTextIndexer:
269269
end = offsets.data.as_uints[i + j]
270270
h = ft_hash_ngram(b_word_ptr, start, end) % self._n_buckets + offset
271271
if with_ngrams:
272-
ngrams.append((h, word[i:i + j]))
272+
ngrams.append((word[i:i + j], h))
273273
else:
274274
ngrams.append(h)
275275
return ngrams

0 commit comments

Comments
 (0)