61980b57db5349ec0adc4a7b4797ee4742c21b73,deeppavlov/models/classifiers/intents/intent_model.py,KerasIntentModel,texts2vec,#KerasIntentModel#Any#,148
Before Change
embeddings_batch = []
for sen in sentences:
tokens = [el for el in sen.split() if el]
if len(tokens) > self.opt["text_size"]:
tokens = tokens[:self.opt["text_size"]]
embeddings = self.fasttext_model.infer(" ".join(tokens) )
if len(tokens) < self.opt["text_size"]:
pads = [np.zeros(self.opt["embedding_size"])
for _ in range(self.opt["text_size"] - len(tokens))]
After Change
pad = np.zeros(self.opt["embedding_size"])
embeddings_batch = self.fasttext_model([" ".join(sen.split()[:self.opt["text_size"]] ) for sen in sentences])
embeddings_batch = [[pad] * (self.opt["text_size"] - len(tokens)) + tokens for tokens in embeddings_batch]
embeddings_batch = np.asarray(embeddings_batch)
return embeddings_batch
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 5
Instances Project Name: deepmipt/DeepPavlov
Commit Name: 61980b57db5349ec0adc4a7b4797ee4742c21b73
Time: 2018-02-15
Author: yoptar@gmail.com
File Name: deeppavlov/models/classifiers/intents/intent_model.py
Class Name: KerasIntentModel
Method Name: texts2vec
Project Name: google/deepvariant
Commit Name: 124b32163e3975e15c59df8b16017f2508b6c233
Time: 2018-04-04
Author: mdepristo@google.com
File Name: third_party/nucleus/io/fasta.py
Class Name: InMemoryRefReader
Method Name: __str__
Project Name: NTMC-Community/MatchZoo
Commit Name: cea292769af4ac688649573a11b20f4d69024e3d
Time: 2019-05-15
Author: 469413628@qq.com
File Name: tests/unit_test/processor_units/test_processor_units.py
Class Name:
Method Name: test_bert_tokenizer_unit
Project Name: OpenNMT/OpenNMT-py
Commit Name: 63871d5ab3301d015805abddd8f4259680d6a24a
Time: 2017-09-21
Author: bpeters@coli.uni-saarland.de
File Name: translate.py
Class Name:
Method Name: main