skillfed

pytextrank

Python implementation of TextRank as a spaCy pipeline extension, for graph-based natural language work plus related knowledge graph practices; used for for phrase extraction of text documents.

pytextrank v3.3.0 117.0K downloads/30d#12,184 on PyPI2,218
Permissive license MIT License Copyright (c) 2016-2022 Derwen, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) Active released

What it is and what it does

PyTextRank is a Python library that brings graph-based text analysis to spaCy by implementing the TextRank algorithm and related variants (PositionRank, Biased TextRank, TopicRank). It works as a spaCy pipeline component, meaning you load a language model, add the textrank pipe, and then process documents to extract ranked phrases and concepts. The library treats text as a graph of words and their relationships, then applies ranking algorithms to identify the most important phrases.

The main use cases are phrase extraction—pulling the top-ranked keywords or key phrases from a document—and low-cost extractive summarization, where you identify the most important sentences or concepts without training a neural model. It also helps convert unstructured text into more structured representations suitable for knowledge graphs. The package depends on spaCy for NLP processing, networkx for graph operations, scipy for numerical work, and several smaller utilities (graphviz, pygments, icecream, GitPython) for visualization and debugging.

Use it for:

  • Extract top-ranked phrases from research papers, articles, or documents for tagging or indexing
  • Perform low-cost extractive summarization by identifying key concepts without training a summarization model
  • Build knowledge graphs by extracting and ranking entities and relationships from unstructured text
  • Identify important keywords from customer feedback, reviews, or support tickets for categorization
  • Rank and filter candidate phrases for downstream NLP tasks like named entity linking or semantic search

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

PyTextRank implements graph-based TextRank and related algorithms as a spaCy pipeline extension to extract key phrases and perform extractive summarization on text documents.

Yes. PyTextRank is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and offers a straightforward way to add graph-based phrase extraction to spaCy workflows. Install friction is low and the library is well-documented. Choose it if you need phrase extraction or concept ranking without the overhead of training custom models.

Install

pytextrank on PyPI

pip

pip install pytextrank

uv

uv add pytextrank

poetry

poetry add pytextrank

Installing pytextrank

Before you install

Low install friction with a pure-Python wheel. Active maintenance with recent commits and a stable release history since 2017; requires spaCy and a language model as runtime dependencies.

License in practice

MIT license permits commercial use, modification, and distribution with minimal restrictions—suitable for proprietary applications.

Quickstart

python3 -m pip install pytextrank
python3 -m spacy download en_core_web_sm

import spacy
import pytextrank

nlp = spacy.load("en_core_web_sm")
nlp.add_pipe("textrank")
doc = nlp("Your text here")
for phrase in doc._.phrases:
    print(phrase.text, phrase.rank)

Requires a spaCy language model to be downloaded separately (e.g., en_core_web_sm for English); spaCy itself is a runtime dependency.

Verify before relying

  • Specific performance characteristics or scalability limits for large documents or corpora
  • Comparison of ranking quality across the four implemented algorithms (TextRank, PositionRank, Biased TextRank, TopicRank)
  • Memory footprint and computational cost relative to alternative phrase extraction methods

Package facts

License MIT License Copyright (c) 2016-2022 Derwen, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 7 — GitPython, graphviz, icecream, networkx, pygments, scipy, spacy
Maintenance actively maintained — 905 days since the last release
Last repo commit
First released
Downloads 117,031/month — #12,184 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pytextrank-3.3.0-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Information TechnologyIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Scientific/Engineering :: Human Machine InterfacesTopic :: Scientific/Engineering :: Information AnalysisTopic :: Scientific/Engineering :: VisualizationTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: GeneralTopic :: Text Processing :: IndexingTopic :: Text Processing :: Linguistic

Tags

phrase extraction from texttextrank implementation pythonspacy pipeline nlpextractive text summarizationkeyword ranking algorithmgraph-based nlpknowledge graph extraction
nlpgraph-algorithmsspacy-extension

More Python Modules packages