Install & Compatibility
Where this runs
tested against v0.12.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
83MB installed
● package 83MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
PlaintextParser
✓ from sumy.parsers.plaintext import PlaintextParser
HtmlParser
✓ from sumy.parsers.html import HtmlParser
Tokenizer
✓ from sumy.nlp.tokenizers import Tokenizer
Stemmer
✓ from sumy.nlp.stemmers import Stemmer
LsaSummarizer
✓ from sumy.summarizers.lsa import LsaSummarizer
LexRankSummarizer
✓ from sumy.summarizers.lex_rank import LexRankSummarizer
LuhnSummarizer
✓ from sumy.summarizers.luhn import LuhnSummarizer
TextRankSummarizer
✓ from sumy.summarizers.text_rank import TextRankSummarizer
get_stop_words
✓ from sumy.utils import get_stop_words
This quickstart demonstrates how to use Sumy to summarize a plain text document using the LSA (Latent Semantic Analysis) summarizer. It includes necessary imports, the required NLTK 'punkt' data download, and sets up a parser, stemmer, and summarizer to extract a specified number of sentences from the input text.
import nltk
from sumy.parsers.plaintext import PlaintextParser
from sumy.nlp.tokenizers import Tokenizer
from sumy.summarizers.lsa import LsaSummarizer
from sumy.nlp.stemmers import Stemmer
from sumy.utils import get_stop_words
# Download NLTK 'punkt' data if not already present
try:
nltk.data.find('tokenizers/punkt')
except LookupError:
nltk.download('punkt')
LANGUAGE = "english"
SENTENCES_COUNT = 5
text = (
"Machine learning is transforming industries worldwide. "
"Companies are investing heavily in AI research and development. "
"The future of technology depends on these advancements. "
"Natural Language Processing (NLP) is a field of Artificial Intelligence "
"that focuses on the interaction between computers and humans through natural language. "
"The goal of NLP is to enable computers to understand, interpret, and generate human language "
"in a way that is both meaningful and useful. "
"Common NLP applications include language translation, sentiment analysis, "
"speech recognition, and text summarization."
)
parser = PlaintextParser.from_string(text, Tokenizer(LANGUAGE))
stemmer = Stemmer(LANGUAGE)
summarizer = LsaSummarizer(stemmer)
summarizer.stop_words = get_stop_words(LANGUAGE)
print(f"Original text length: {len(text.split())} words\n")
print(f"Summary ({SENTENCES_COUNT} sentences) using LSA Summarizer:\n")
for sentence in summarizer(parser.document, SENTENCES_COUNT):
print(sentence)
summy --version
Errors
Common errors & fixes
LookupError:
**********************************************************************
Resource 'tokenizers/punkt' not found.
Please use the NLTK Downloader to obtain the resource:
>>> import nltk
>>> nltk.download('punkt')
For more information see: https://www.nltk.org/data.html
Attempted to load tokenizers/punkt/PY3/english.pickle
Searched in:
- '/home/user/nltk_data'
- '/usr/share/nltk_data'
- '/usr/local/share/nltk_data'
- '/usr/lib/nltk_data'
- '/usr/local/lib/nltk_data'
**********************************************************************
The NLTK 'punkt' tokenizer data, a core dependency for Sumy's tokenizers, has not been downloaded.
fixRun `python -c "import nltk; nltk.download('punkt')"` to download the required NLTK data files. ValueError: Chinese tokenizer requires jieba. Please, install it by command 'pip install jieba'.
Attempting to use a Sumy tokenizer for a language (e.g., Chinese) that requires an external, non-default Python library, and that library is not installed.
fixInstall the missing language-specific dependency. For Chinese, `pip install jieba`. Refer to Sumy's documentation for other languages or use `pip install sumy[language]` where 'language' is the relevant extra.
from collections import Sequence # Compatibility for Python 3.10
This is typically a traceback snippet indicating a compatibility issue with `collections.Sequence` which was deprecated and then removed in Python 3.10 and 3.11 respectively. Sumy versions prior to 0.10.0 had this issue.
fixUpgrade Sumy to version 0.10.0 or newer: `pip install --upgrade sumy`. This version includes a fix for Python 3.10+ compatibility. Also ensure your Python environment is 3.8 or newer.
Upgrade
Version history
0.12.0latest on PyPI · released Feb 14, 2026
Audit
Dependencies
nltkrequiredRequired for default tokenizers and stemmers; specific data ('punkt') must be downloaded.
numpyoptionalRequired by the LSA summarizer.
requestsoptionalRequired for parsing content from URLs (e.g., HtmlParser).
jiebaoptionalRequired for Chinese language tokenizer.
konlpyoptionalRequired for Korean language tokenizer.
tinysegmenteroptionalRequired for Japanese language tokenizer.
pythainlpoptionalRequired for Thai language tokenizer.
hebrew_tokenizeroptionalRequired for Hebrew language tokenizer.