MCPcopy Create free account
hub / github.com/649453932/Chinese-Text-Classification-Pytorch / biGramHash

Function biGramHash

utils_fasttext.py:43–45  ·  view source on GitHub ↗
(sequence, t, buckets)

Source from the content-addressed store, hash-verified

41 print(f"Vocab size: {len(vocab)}")
42
43 def biGramHash(sequence, t, buckets):
44 t1 = sequence[t - 1] if t - 1 >= 0 else 0
45 return (t1 * 14918087) % buckets
46
47 def triGramHash(sequence, t, buckets):
48 t1 = sequence[t - 1] if t - 1 >= 0 else 0

Callers 1

load_datasetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected