old_settings = np.seterr(all="ignore")
for c in bytearray(s):
h = h ^ np.uint32(np.int8(c))
h = h * np.uint32(16777619)
np.seterr(**old_settings)
return h
def _word_to_hashes(self, word):
if word not in self._cache:
if word not in self.special_tokens:
After Change
@staticmethod
def fasttext_hash_asbytes(ngram, encoding="utf-8"):
ngram_enc = bytearray(ngram.encode(encoding))
_fasttext_hash(ngram_enc)
def _word_to_hashes(self, word):
if word not in self.special_tokens: