- Notifications
You must be signed in to change notification settings - Fork255
TextRank implementation for Python 3.
License
summanlp/textrank
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
TextRank implementation for text summarization and keyword extraction in Python 3,withoptimizations on the similarity function.
- Text summarization
- Keyword extraction
Text summarization:
>>> text = """Automatic summarization is the process of reducing a text document with a \computer program in order to create a summary that retains the most important points \of the original document. As the problem of information overload has grown, and as \the quantity of data has increased, so has interest in automatic summarization. \Technologies that can make a coherent summary take into account variables such as \length, writing style and syntax. An example of the use of summarization technology \is search engines such as Google. Document summarization is another.""">>> from summa import summarizer>>> print(summarizer.summarize(text))'Automatic summarization is the process of reducing a text document with a computerprogram in order to create a summary that retains the most important points of theoriginal document.'
Keyword extraction:
>>> from summa import keywords>>> print(keywords.keywords(text))documentsummarizationwritingaccount
Note that line breaks in the input will be used as sentence separators, so be sureto preprocess your text accordingly.
This software isavailable in PyPI.It depends onNumPy andScipy,two Python libraries for scientific computing.Pip will automatically install them along with summa:
pip install summa
For a better performance of keyword extraction, installPattern.
Command-line usage:
textrank -t FILE
Define length of the summary as a proportion of the text (also available in
keywords):>>> from summa.summarizer import summarize>>> summarize(text, ratio=0.2)
Define length of the summary by aproximate number of words (also available in
keywords):>>> summarize(text, words=50)
Define input text language (also available in
keywords).The available languages are arabic, danish, dutch, english, finnish, french, german,hungarian, italian, norwegian, polish, porter, portuguese, romanian, russian,spanish and swedish:
>>> summarize(text, language='spanish')
Get results as a list (also available in
keywords):>>> summarize(text, split=True)['Automatic summarization is the process of reducing a text document with acomputer program in order to create a summary that retains the most importantpoints of the original document.']
- Mihalcea, R., Tarau, P.:"Textrank: Bringing order into texts".In: Lin, D., Wu, D. (eds.)Proceedings of EMNLP 2004. pp. 404–411. Association for Computational Linguistics,Barcelona, Spain. July 2004.
- Barrios, F., López, F., Argerich, L., Wachenchauzer, R.:"Variations of the Similarity Function of TextRank for Automated Summarization".Anales de las 44JAIIO.Jornadas Argentinas de Informática, Argentine Symposium on Artificial Intelligence, 2015.
To cite this work:
@article{DBLP:journals/corr/BarriosLAW16, author = {Federico Barrios and Federico L{\'{o}}pez and Luis Argerich and Rosa Wachenchauzer}, title = {Variations of the Similarity Function of TextRank for Automated Summarization}, journal = {CoRR}, volume = {abs/1602.03606}, year = {2016}, url = {http://arxiv.org/abs/1602.03606}, archivePrefix = {arXiv}, eprint = {1602.03606}, timestamp = {Wed, 07 Jun 2017 14:40:43 +0200}, biburl = {https://dblp.org/rec/bib/journals/corr/BarriosLAW16}, bibsource = {dblp computer science bibliography, https://dblp.org}}Summa is open source software released under theThe MIT License (MIT).
Copyright (c) 2014 – now Summa NLP.
About
TextRank implementation for Python 3.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors11
Uh oh!
There was an error while loading.Please reload this page.