Exemplo n.º 1
0
    def create_reach_object(self, strings, normalize=False, outfile=''):

        vectors = []
        for s in tqdm(strings):
            token_embs = self.vectorize_string(s, norm=normalize)
            vector = np.average(np.array(token_embs), axis=0)
            vectors.append(vector)

        reach_object = Reach(vectors, list(strings))

        if outfile:
            reach_object.save_fast_format(outfile)

        return reach_object
Exemplo n.º 2
0
    def create_reach_object(self, names, outfile=''):

        names = sorted(names)

        vectors = []
        for name in tqdm(names):
            token_embs = self.vectorize_string(name, norm=False)
            vector = np.average(np.array(token_embs), axis=0)
            vectors.append(vector)

        reach_object = Reach(vectors, names)

        if outfile:
            reach_object.save_fast_format(outfile)

        return reach_object