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

Function triGramHash

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

Source from the content-addressed store, hash-verified

45 return (t1 * 14918087) % buckets
46
47 def triGramHash(sequence, t, buckets):
48 t1 = sequence[t - 1] if t - 1 >= 0 else 0
49 t2 = sequence[t - 2] if t - 2 >= 0 else 0
50 return (t2 * 14918087 * 18408749 + t1 * 14918087) % buckets
51
52 def load_dataset(path, pad_size=32):
53 contents = []

Callers 1

load_datasetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected