Python implementation of TextRank algorithm ( for automatic keyword extraction and summarization using Levenshtein distance as relation between text units.
Switch branches/tags
Nothing to show
Clone or download
davidadamojr Merge pull request #14 from jessexoc/master
Add editdistance requirement to
Latest commit 5d178e8 Mar 13, 2018


This is a python implementation of TextRank for automatic keyword and sentence extraction (summarization) as done in However, this implementation uses Levenshtein Distance as the relation between text units.

This implementation carries out automatic keyword and sentence extraction on 10 articles gotten from

  • 100 word summary
  • Number of keywords extracted is relative to the size of the text (a third of the number of nodes in the graph)
  • Adjacent keywords in the text are concatenated into keyphrases


To install the library run the module located in the repository's root directory. Alternatively, if you have access to pip you may install the library directly from github:

pip install git+git://

Use of the library requires downloading nltk resources. Use the textrank initialize command to fetch the required data. Once the data has finished downloading you may execute the following commands against the library:

textrank extract_summary <filename>
textrank extract_phrases <filename>


Install the library as "editable" within a virtual environment.

pip install -e .


Dependencies are installed automatically with pip but can be installed serparately.