Skip to main content

Python implimentation of TextRank for text document NLP parsing and summarization

Project description

A pure Python implementation of TextRank, based on the Mihalcea 2004 paper.

Modifications to the original Mihalcea algorithm include:

  • fixed bug; see Java impl, 2008

  • use of lemmatization instead of stemming

  • verbs included in the graph (but not in the resulting keyphrases)

  • normalized keyphrase ranks used in summarization

The results produced by this implementation are intended more for use as feature vectors in machine learning, not as academic paper summaries.

Inspired by Williams 2016 talk on text summarization.

Dependencies and Installation

This code has dependencies on several other Python projects:

To install:

pip install -r requirements.txt

The runtime depends on a local file called stop.txt which contains a list of stopwords.

Install model

After installation you need to download a language model:

python -m nltk.downloader punkt
python -m nltk.downloader wordnet
python -m textblob.download_corpora
python -m spacy.en.download all

Example Usage

See PyTextRank wiki

Kudos

@htmartin @williamsmj @eugenep @mattkohl @HarshGrandeur @mnowotka

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytextrank-1.0.tar.gz (8.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page