您当前的位置: 首页 >  算法
  • 0浏览

    0关注

    2393博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

NLP之TM之LDA:利用LDA算法瞬时掌握文档的主题内容—利用希拉里邮件数据集训练LDA模型并对新文本进行主题分类

一个处女座的程序猿 发布时间:2019-02-18 21:02:02 ,浏览量:0

NLP之TM之LDA:利用LDA算法瞬时掌握文档的主题内容—利用希拉里邮件数据集训练LDA模型并对新文本进行主题分类

 

 

 

目录

输出结果

设计思路

核心代码

训练数据集

LDA模型应用

 

 

 

输出结果

 

设计思路

 

核心代码
lda = gensim.models.ldamodel.LdaModel(corpus=corpus, id2word=dictionary, num_topics=20)
print('输出第10号分类:',lda.print_topic(10, topn=5))  
print('输出所有的主题分类:',lda.print_topics(num_topics=20, num_words=5))    
  训练数据集

下载链接:希拉里邮件数据集

 

 

 

LDA模型应用

使用训练好的LDA模型,输入以下几句话,判定各自属于哪个topic

Already voted? That's great! Now help Hillary win by signing up to make calls now It's Election Day! Millions of Americans have cast their votes for Hillary—join them and confirm where you vote We don’t want to shrink the vision of this country. We want to keep expanding it We have a chance to elect a 45th president who will build on our progress, who will finish the job  

 

 

 

 

 

关注
打赏
1664196048
查看更多评论
立即登录/注册

微信扫码登录

0.0846s