def __init__(self, nlp): Model.__init__(self) self._id_map = {0: 0} self.nO = nlp.vocab.vectors_length self.nM = self.nO self.nV = len(nlp.vocab) self.W.fill(0) vectors = self.vectors for i, word in enumerate(nlp.vocab): self._id_map[word.orth] = i + 1 vectors[i + 1] = word.vector / (word.vector_norm or 1.)
def __init__(self, nlp, nO): Model.__init__(self) self._id_map = {0: 0} self.nO = nO self.nM = nlp.vocab.vectors_length self.nlp = nlp