def run(self, input: List(ContinuousVector())) -> ContinuousVector(): input = np.vstack(input) if self.mode == "mean": return input.mean(axis=1) elif self.mode == "max": return input.max(axis=1) raise ValueError("Invalid mode: %s" % self.mode)
def run( self, input: Word(domain="general", language="spanish") ) -> ContinuousVector(): """This method use Word2Vec of gensim for tranform a word in embedding vector. """ try: return self.model.get_vector(input.lower()) except KeyError: return np.zeros(400)
def run(self, input: List(ContinuousVector())) -> MatrixContinuousDense(): return np.vstack(input)