我是靠谱客的博主 优雅烧鹅,这篇文章主要介绍python textrank_TextRank的纯Python实现 – pytextrank,现在分享给大家,希望可以做个参考。

Python impl for TextRank

一个TextRank的纯Python实现,基于Mihalcea 2004 paper。

对原始Mihalcea算法的改进包括:

修复bug;

使用词干提取而不是阻塞

包含在图表中的动词

总结中的归一化关键词排名

依赖和安装

这个代码依赖了几个其他的Python项目:

TextBlob

NetworkX

datasketch

graphviz

matlibplot

安装:

conda config --add channels https://conda.binstar.org/sloria

conda install textblob

pip install -U git+https://github.com/sloria/textblob-aptagger.git@dev

sudo python -m nltk.downloader punkt

sudo python -m nltk.downloader wordnet

sudo python -m textblob.download_corpora

pip install networkx

pip install statistics

pip install datasketch -U

pip install graphviz

pip install matplotlib

示例使用

运行基于Mihalcea paper的测试用例:

./stage1.py dat/mih.json > out1.json

./stage2.py out1.json > out2.json

测试用例结果应该为:

0.0956 types systems

0.0627 nonstrict inequations

0.0622 minimal supporting set

0.0596 mixed types

0.0571 strict inequations

0.0568 natural numbers

0.0568 minimal set

0.0545 linear diophantine equations

0.0539 linear constraints

0.0528 corresponding algorithms

0.0474 upper bounds

最后

以上就是优雅烧鹅最近收集整理的关于python textrank_TextRank的纯Python实现 – pytextrank的全部内容,更多相关python内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(54)

评论列表共有 0 条评论

立即
投稿
返回
顶部