def step7():
term_clus = pickle.loads(open("./news.term_clus.pkl", "rb").read())
term_clus = {term:clus for term, clus in filter(lambda x: sum(x[1]) > 30, term_clus.items()) }
for term in term_clus.keys():
vec = term_clus[term]
acc = sum(vec)
term_clus[term] = list(map(lambda x:x/acc, vec))
open("news.term_dist.pkl", "wb").write(pickle.dumps(term_clus))
term_clus = pickle.loads(open("./nocturne.term_clus.pkl", "rb").read())
term_clus = {term:clus for term, clus in filter(lambda x: sum(x[1]) > 30, term_clus.items()) }
for term in term_clus.keys():
vec = term_clus[term]
acc = sum(vec)
term_clus[term] = list(map(lambda x:x/acc, vec))
open("nocturne.term_dist.pkl", "wb").write(pickle.dumps(term_clus))
评论列表
文章目录