Beispiel #1
0
def write_vecs(finname, foutname):
    og_embed = Embedding.load(finname, normalize=False)
    red_embed = og_embed.get_subembed(TOP_WORDS)
    np.save(foutname+".npy", red_embed.m)
    with file(foutname+".vocab","w") as outf:
       print >> outf, " ".join(red_embed.iw)
 def __init__(self, years, top_freq=None):
     self.embeds = collections.OrderedDict()
     for year in years:
         self.embeds[year] = Embedding.load(INPUT_PATH.format(year=year))