def create_representation(args): rep_type = args['<representation>'] path = args['<representation_path>'] w_c = args['--w+c'] eig = float(args['--eig']) if rep_type == 'PPMI': if w_c: raise Exception('w+c is not implemented for PPMI.') else: return Explicit.load(path, True) elif rep_type == 'SVD': if w_c: return EnsembleEmbedding(SVDEmbedding(path, False, eig, False), SVDEmbedding(path, False, eig, True), True) else: return SVDEmbedding(path, True, eig) else: if w_c: return EnsembleEmbedding(Embedding.load(path + '.words', False), Embedding.load(path + '.contexts', False), True) else: return Embedding.load(path, True)
def create_representation(rep_type, path, *args, **kwargs): if rep_type == 'Explicit' or rep_type == 'PPMI': return Explicit.load(path, *args, **kwargs) elif rep_type == 'SVD': return SVDEmbedding(path, *args, **kwargs) elif rep_type == 'GIGA': return GigaEmbedding(path, *args, **kwargs) elif rep_type == 'Embedding': return Embedding.load(path, *args, **kwargs)
def create_representation(rep_type, path, *args, **kwargs): if rep_type == 'Explicit' or rep_type == 'PPMI': return Explicit.load(path, *args, **kwargs) elif rep_type == 'SVD': return SVDEmbedding(path, *args, **kwargs) elif rep_type == 'GIGA': return GigaEmbedding(path, *args, **kwargs) elif rep_type: return Embedding.load(path, *args, **kwargs)
def simple_create_representation(rep_type, path, restricted_context=None, thresh=None, normalize=True): if rep_type == 'PPMI': return Explicit.load(path, normalize=normalize, restricted_context=restricted_context, thresh=thresh) else: return Embedding.load(path, True)