2c5f22199b46837b9801378ce172dcd13f125769,gluonnlp/vocab/subwords.py,NGramHashes,_word_to_hashes,#NGramHashes#Any#,211
Before Change
return h
def _word_to_hashes(self, word):
if word not in self._cache:
if word not in self.special_tokens:
hashes = nd.array([
self.fasttext_hash_asbytes((u"<" + word + u">")[i:i + N]) % self.num_subwords
for N in self.ngrams for i in range((len(word) + 2) - N + 1)
])
else:
hashes = nd.zeros(shape=0)
if self.cache:
self._cache[word] = hashes
return hashes
return self._cache[word]
def __call__(self, words):
return [self._word_to_hashes(word) for word in words]
After Change
memoryview(word_enc), ns=self._ngrams,
bucket_size=self.num_subwords)
else:
hashes = []
return hashes
def __call__(self, words):
return [self._word_to_hashes(word) for word in words]
In pattern: SUPERPATTERN
Frequency: 5
Non-data size: 4
Instances
Project Name: dmlc/gluon-nlp
Commit Name: 2c5f22199b46837b9801378ce172dcd13f125769
Time: 2018-07-17
Author: leonard@lausen.nl
File Name: gluonnlp/vocab/subwords.py
Class Name: NGramHashes
Method Name: _word_to_hashes
Project Name: keras-team/keras
Commit Name: 023331ec2a7b0086abfc81eca16c84a1692ee653
Time: 2017-02-09
Author: francois.chollet@gmail.com
File Name: keras/layers/convolutional.py
Class Name: AtrousConvolution1D
Method Name: __init__
Project Name: keras-team/keras
Commit Name: b6ca3ef051107f544b97cdb315eaf1b8e12665d9
Time: 2016-06-19
Author: lucas.moura128@gmail.com
File Name: keras/callbacks.py
Class Name: History
Method Name: on_epoch_end
Project Name: keras-team/keras
Commit Name: b938b91b527760cef3af29031e74ab181f2fc2b9
Time: 2019-07-07
Author: psv@google.com
File Name: keras/engine/training_generator.py
Class Name:
Method Name: evaluate_generator
Project Name: NTMC-Community/MatchZoo
Commit Name: 53a93d8af5d041f6c5dfdef2fb763f8419e3023d
Time: 2019-01-19
Author: i@uduse.com
File Name: matchzoo/datasets/snli/load_data.py
Class Name:
Method Name: load_data