deal.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:DomainDependencyMemeJsai2017 作者: GINK03 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号