TextRank models a document as a co-occurrence graph where vertices represent lexical units (words or phrases) and weighted edges represent their collocation within a defined sliding window. The algorithm initializes all vertices with equal scores and iteratively updates them using the PageRank formula until convergence, effectively identifying central nodes that act as 'recommenders' for other important terms. Unlike supervised methods, it requires no labeled training data.
Glossary
TextRank

What is TextRank?
TextRank is an unsupervised, graph-based ranking algorithm that builds a word or phrase co-occurrence network from a document and applies a PageRank-derived iterative scoring mechanism to identify the most salient keyphrases.
The algorithm's strength lies in its ability to capture global structural salience rather than just local frequency. By ranking phrases based on their connectivity within the entire text network, TextRank naturally filters out high-frequency but semantically weak terms. It is widely used for unsupervised keyphrase extraction and automatic summarization, often serving as a robust baseline against which embedding-based methods like EmbedRank are compared.
Core Characteristics of TextRank
TextRank is a graph-based ranking algorithm for unsupervised keyphrase extraction that models a document as a co-occurrence network and applies PageRank to identify the most salient phrases.
Graph-Based Ranking Model
TextRank constructs a co-occurrence graph where vertices represent words or phrases, and edges are weighted by their co-occurrence frequency within a sliding window. The algorithm then applies a recursive PageRank-style computation to score each vertex based on the importance of its neighbors. The core formula iterates until convergence:
S(Vi) = (1 - d) + d * Σ (w_ji / Σ w_jk) * S(Vj)
- d: Damping factor (typically 0.85), controlling the probability of jumping to a random vertex
- w_ji: Weight of the edge between vertex j and vertex i
- Convergence: Scores stabilize when the difference between iterations falls below a threshold
Unsupervised and Domain-Independent
TextRank requires no labeled training data and operates independently of domain-specific corpora. It relies solely on the intrinsic structure of the input document:
- No external knowledge bases: Unlike Wikification approaches, TextRank does not require Wikipedia or ontologies
- Language agnostic: Works on any language with tokenization and POS tagging support
- Single-document processing: Extracts keyphrases from one document at a time without needing a background corpus
- Bootstrapping: Uses the document's own lexical cohesion patterns to determine salience
Candidate Phrase Filtering
Before graph construction, TextRank applies syntactic filters to select candidate phrases. The original implementation uses part-of-speech (POS) tag patterns to extract noun phrases:
- Pattern: Sequences of zero or more adjectives followed by one or more nouns
(JJ)*(NN)+ - Stopword handling: Stopwords are excluded from candidate phrases but preserved for co-occurrence context
- Multi-word phrases: Post-processing merges adjacent single-word candidates that appear consecutively in the text
- Filtering rationale: Restricts the graph to content-bearing terms, reducing noise and computational complexity
Post-Processing and Ranking
After the PageRank scores converge, TextRank applies post-processing steps to produce the final ranked keyphrase list:
- Phrase merging: Adjacent single-word candidates with high individual scores are combined into multi-word phrases
- Score aggregation: The score of a merged phrase is the sum of its constituent word scores
- Top-K selection: The highest-scoring phrases are returned, typically the top 10-20 candidates
- Redundancy control: Unlike MMR-based approaches, TextRank does not explicitly penalize redundancy, which can lead to semantically overlapping keyphrases
TextRank for Summarization
Beyond keyphrase extraction, TextRank extends naturally to extractive summarization by treating sentences as vertices:
- Sentence graph: Vertices are sentences; edges are weighted by inter-sentence similarity (e.g., TF-IDF cosine or lexical overlap)
- Similarity threshold: Edges are only created when similarity exceeds a minimum threshold, preventing a fully connected graph
- Ranking: PageRank identifies the most central sentences that collectively represent the document's core content
- Multi-document variant: Can be applied across document clusters by building a unified sentence graph
Strengths and Limitations
TextRank offers a compelling balance of simplicity and effectiveness, but has known trade-offs:
Strengths:
- No training required: Fully unsupervised, deployable on any text immediately
- Interpretable: Graph structure and scores are transparent and auditable
- Lightweight: Minimal computational overhead compared to embedding-based methods like KeyBERT
Limitations:
- Cannot extract absent keyphrases: Only identifies phrases present verbatim in the text
- Frequency bias: Favors frequently occurring terms, potentially missing rare but salient concepts
- No semantic understanding: Relies on surface co-occurrence rather than deep contextual meaning
TextRank vs. Other Keyphrase Extraction Methods
A feature-level comparison of TextRank against other widely used unsupervised keyphrase extraction algorithms, highlighting architectural differences and operational characteristics.
| Feature | TextRank | TF-IDF | RAKE | YAKE |
|---|---|---|---|---|
Core Mechanism | Graph-based ranking (PageRank on co-occurrence network) | Statistical weighting (term frequency × inverse document frequency) | Stopword-delimited phrase scoring (word degree/frequency ratio) | Statistical feature scoring (5 features from single document) |
Requires External Corpus | ||||
Handles Multi-word Phrases | ||||
Language Independence | ||||
POS Tagging Required | ||||
Typical Precision@10 on Inspec | 31.2% | 24.7% | 28.6% | 33.8% |
Computational Complexity | O(|V|²) per iteration (graph construction + PageRank convergence) | O(N) (linear scan of term frequencies) | O(N) (single pass with sliding window) | O(N) (single pass with sliding window) |
Sensitivity to Document Length | Moderate (graph density increases with length) | High (short documents produce sparse vectors) | Low (window-based co-occurrence is robust) | Low (normalized statistical features) |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Frequently Asked Questions
Clear, technically precise answers to the most common questions about the graph-based keyphrase extraction algorithm.
TextRank is an unsupervised, graph-based ranking algorithm for extracting keyphrases and summarizing text. It operates by building a co-occurrence graph where vertices represent words or phrases, and weighted edges represent the strength of their association within a sliding window. The algorithm then applies a modified PageRank iterative convergence process to score each vertex based on the principle of 'voting' or 'recommendation'—a vertex is important if it is linked to by other important vertices. Unlike supervised methods, TextRank requires no labeled training data, relying solely on the structural properties of the text itself. After convergence, the top-ranked vertices are post-processed to form the final multi-word keyphrases.
Related Terms
Explore the core algorithms, evaluation metrics, and conceptual building blocks that surround the graph-based TextRank approach.
Graph-based Ranking
The foundational family of algorithms that TextRank belongs to. These methods represent text units (words or phrases) as vertices in a network and use structural centrality measures to determine salience.
- Mechanism: Builds a co-occurrence graph and iteratively computes vertex scores until convergence.
- Key Variants: TextRank, SingleRank, TopicRank, and PositionRank.
- Advantage: Unsupervised and domain-independent, requiring no labeled training data.
Co-occurrence Graph
The specific network representation that powers TextRank. Nodes represent candidate words or phrases, while edges are weighted by their frequency of co-occurrence within a sliding window.
- Window Size: Typically set between 2 and 10 words to capture local syntactic relations.
- Edge Weighting: Can be binary or weighted by the number of times two terms appear together.
- Role: This graph structure directly determines which terms reinforce each other during the PageRank scoring iterations.
Candidate Scoring
The process of assigning a numerical weight to each candidate phrase after graph construction. TextRank uses PageRank convergence scores as the primary relevance signal.
- Post-Processing: Scores can be combined with positional features or frequency boosts.
- Top-K Selection: The highest-scoring candidates are selected as the final keyphrases.
- Contrast: Unlike statistical methods like TF-IDF, the score reflects global structural importance rather than local frequency.
F1@K
The standard evaluation metric for measuring keyphrase extraction performance against a gold-standard set. It computes the harmonic mean of precision and recall for the top-K predicted keyphrases.
- Precision: The fraction of predicted keyphrases that match the ground truth.
- Recall: The fraction of ground-truth keyphrases that are successfully predicted.
- Usage: F1@5 and F1@10 are common benchmarks on datasets like KP20k and Inspec.
Maximal Marginal Relevance (MMR)
A re-ranking algorithm often applied to TextRank's output to improve diversity. It balances a phrase's relevance to the document against its redundancy with already selected keyphrases.
- Lambda Parameter: Controls the trade-off between relevance and novelty.
- Benefit: Prevents the top-K list from being dominated by semantically identical phrases.
- Integration: Applied as a post-processing step after the initial graph-based ranking is complete.
Phrase Candidate Generation
The critical pre-processing step before TextRank can be applied. This stage produces a set of potential n-grams using Part-of-Speech (POS) tagging and noun phrase chunking.
- Filters: Sequences matching specific POS patterns (e.g., adjective-noun) are retained.
- Stopword Delimiting: Multi-word phrases are often identified by splitting text on stopwords.
- Impact: The quality of candidate generation directly limits the maximum achievable extraction accuracy.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us