Skip to main content

Python implimentation of TextRank for text document NLP parsing and summarization

Project description

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

Modifications to the original algorithm by Rada Mihalcea, et al. include:

  • fixed bug; see Java impl, 2008
  • use of lemmatization instead of stemming
  • verbs included in the graph (but not in the resulting keyphrases)
  • named entity recognition
  • 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.

Example Usage

See PyTextRank wiki

Dependencies and Installation

This code has dependencies on several other Python projects:

To install from PyPi:

pip install pytextrank

To install from this Git repo:

pip install -r requirements.txt

After installation you need to download a language model:

python -m spacy download en

Also, the runtime depends on a local file called stop.txt which contains a list of stopwords. You can override this in the normalize_key_phrases() call.

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
pytextrank-1.1.0.tar.gz (9.0 kB) Copy SHA256 hash SHA256 Source None Jun 7, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page