(self, query, n=10)
return nearest, best_metrics
Find similar sentences by vector distances
        metric = dot(vectors_of_vectors, vectors_of_target_vector)
        Uses a precomputed vectors of the vectors
        Parameters

        Arguments:
            query (ndarray): query sentence vector
            n (int): top n number of neighbors

        Returns:
            position in self.vocab_w2id
            cosine similarity
Find similar sentences by vector distances
        metric = dot(vectors_of_vectors, vectors_of_target_vector)
        Uses a precomputed vectors of the vectors
        Parameters
Find similar sentences by vector distances metric = dot ( vectors_of_vectors vectors_of_target_vector ) Uses a precomputed vectors of the vectors Parameters
def find_similar(self, query, n=10):
        """
        Find similar sentences by vector distances
        metric = dot(vectors_of_vectors, vectors_of_target_vector)
        Uses a precomputed vectors of the vectors
        Parameters

        Arguments:
            query (ndarray): query sentence vector
            n (int): top n number of neighbors

        Returns:
            position in self.vocab_w2id
            cosine similarity
        """
        query = query / np.linalg.norm(query)
        metrics = np.dot(self.vectors, query.T)

        best = np.argsort(metrics.ravel())[::-1][:n]
        best_metrics = metrics[best]
        nearest = [self.text[b] for b in best.tolist()]

        return nearest, best_metrics
def find_similar ( self , query , n = 10 ) : query = query / np . linalg . norm ( query ) metrics = np . dot ( self . vectors , query . T ) best = np . argsort ( metrics . ravel ( ) ) [ : : - 1 ] [ : n ] best_metrics = metrics [ best ] nearest = [ self . text [ b ] for b in best . tolist ( ) ] return nearest , best_metrics