Registry / ai-ml / pytextrank

pytextrank

JSON →
library3.3.0pypypiunverified

Python implementation of TextRank as a spaCy pipeline extension for graph-based natural language work including phrase extraction, keyword extraction, and knowledge graph extraction. Current version 3.3.0, requires Python >=3.7, follows spaCy's extension pattern. Development is active but releases are infrequent.

pip install pytextrank
INSTALL
IMPORT
SIG · PYTEXTRANK
P
pytextrank
ai-mlpythonv3.3.0
Install
25.9s avg
Import
—
Disk
628MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v3.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 27.1s
py 3.11
✓ —
✓ 25.7s
py 3.12
✓ —
✓ 24.9s
py 3.13
✓ —
✓ 25.8s
py 3.9
✕ build_error
✕ build_error
628MB installed
● package 628MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PyTextRank
✓ import pytextrank
✗ from pytextrank import PyTextRank

Loads spaCy model, adds PyTextRank pipeline, processes text, and prints extracted keyphrases with rank and count.

import spacy import pytextrank nlp = spacy.load('en_core_web_sm') nlp.add_pipe('pytextrank') text = "Natural language processing enables computers to understand human language. It is used in chatbots and translation." doc = nlp(text) for phrase in doc._.phrases: print(phrase.text, phrase.rank, phrase.count)
Debug
Known issues
breakingPyTextRank 3.x requires spaCy 3.x. It will not work with spaCy 2.x. If you have spaCy 2.x, install an older PyTextRank version (<=2.x) or upgrade spaCy.
fix
Upgrade spaCy: pip install -U spacy
affects: pytextrank>=3.0.0, <3.0.0 with spacy<3.0.0
deprecatedAccessing keyphrases via doc._.phrases has replaced the older method doc._.textrank. The old method will be removed in a future version.
fix
Use doc._.phrases instead of doc._.textrank.
affects: pytextrank>=3.2.0, <3.3.0
gotchaThe spaCy model must be loaded before adding PyTextRank pipeline. Adding the pipeline before loading the model will fail silently or raise an error.
fix
Ensure nlp = spacy.load('en_core_web_sm') before nlp.add_pipe('pytextrank').
affects: all
Upgrade
Version history
3.3.0latest on PyPI · released Feb 21, 2024
Audit
Dependencies
spacyrequiredCore dependency as a pipeline component; must match spaCy version compatibility
networkxoptionalUsed for graph algorithms; may be optional in future
Agent activity
16 hits · last 30 days
node
12
OpenAI (training)
1
Resources