61980b57db5349ec0adc4a7b4797ee4742c21b73,deeppavlov/models/classifiers/intents/intent_model.py,KerasIntentModel,texts2vec,#KerasIntentModel#Any#,148

Before Change


        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))]
                embeddings = pads + embeddings

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)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

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: Scitator/catalyst
Commit Name: 2775c15702fd52f081ff8fded51f4f38877659df
Time: 2019-08-01
Author: scitator@gmail.com
File Name: examples/_tests_scripts/z_classification.py
Class Name:
Method Name: