miso-belica
sumy
Python

Module for automatic summarization of text documents and HTML pages.

Last updated Jul 7, 2026
3.7k
Stars
543
Forks
29
Issues
+1
Stars/day
Attention Score
81
Language breakdown
No language data available.
β–Έ Files click to expand
README

Automatic text summarizer

image GitPod Ready-to-Code

Simple library and command line utility for extracting summary from HTML pages or plain texts. The package also contains simple evaluation framework for text summaries. Implemented summarization methods are described in the documentation. I also maintain a list of alternative implementations of the summarizers in various programming languages.

Is my natural language supported?

There is a good chance it is. But if not it is not too hard to add it.

Installation

Make sure you have Python 3.8+ installed.

Using uv (recommended)

uv is a modern, fast Python package installer and resolver.

$ uv pip install sumy
$ uv pip install git+https://github.com/miso-belica/sumy.git  # for the fresh version

Using pip

$ pip install sumy
$ pip install git+git://github.com/miso-belica/sumy.git  # for the fresh version

For development

If you want to contribute or modify the code:

$ git clone https://github.com/miso-belica/sumy.git
$ cd sumy
$ uv sync               # Install dependencies (dev group included automatically)
$ uv run pytest         # Run tests
$ uv run sumy --help    # Run sumy using uv

Usage

Thanks to some good soul out there, the easiest way to try sumy is in your browser at https://huggingface.co/spaces/issam9/sumy_space

Sumy contains command line utility for quick summarization of documents.

$ sumy lex-rank --length=10 --url=https://en.wikipedia.org/wiki/Automatic_summarization # what's summarization?
$ sumy lex-rank --language=uk --length=30 --url=https://uk.wikipedia.org/wiki/Π£ΠΊΡ€Π°Ρ—Π½Π°
$ sumy luhn --language=czech --url=https://www.zdrojak.cz/clanky/automaticke-zabezpeceni/
$ sumy edmundson --language=czech --length=3% --url=https://cs.wikipedia.org/wiki/BitvauLipan
$ sumy --help # for more info

Various evaluation methods for some summarization method can be executed by commands below:

$ sumyeval lex-rank referencesummary.txt --url=https://en.wikipedia.org/wiki/Automatic_summarization
$ sumyeval lsa referencesummary.txt --language=czech --url=https://www.zdrojak.cz/clanky/automaticke-zabezpeceni/
$ sumyeval edmundson referencesummary.txt --language=czech --url=https://cs.wikipedia.org/wiki/BitvauLipan
$ sumy_eval --help # for more info

If you don't want to bother by the installation, you can try it as a container.

$ docker run --rm misobelica/sumy lex-rank --length=10 --url=https://en.wikipedia.org/wiki/Automatic_summarization

Python API

Or you can use sumy like a library in your project. Create file sumyexample.py (don't name it sumy.py) with the code below to test it.

# -- coding: utf-8 --

from future import absolute_import from future import division, printfunction, unicodeliterals

from sumy.parsers.html import HtmlParser from sumy.parsers.plaintext import PlaintextParser from sumy.nlp.tokenizers import Tokenizer from sumy.summarizers.lsa import LsaSummarizer as Summarizer from sumy.nlp.stemmers import Stemmer from sumy.utils import getstopwords

LANGUAGE = "english" SENTENCES_COUNT = 10

if name == "main": url = "https://en.wikipedia.org/wiki/Automatic_summarization" parser = HtmlParser.from_url(url, Tokenizer(LANGUAGE)) # or for plain text files # parser = PlaintextParser.from_file("document.txt", Tokenizer(LANGUAGE)) # parser = PlaintextParser.from_string("Check this out.", Tokenizer(LANGUAGE)) stemmer = Stemmer(LANGUAGE)

summarizer = Summarizer(stemmer) summarizer.stopwords = getstop_words(LANGUAGE)

for sentence in summarizer(parser.document, SENTENCES_COUNT): print(sentence)

Interesting projects using sumy

I found some interesting projects while browsing the internet or sometimes people wrote me an e-mail with questions, and I was curious how they use the sumy :)

  • Learning to generate questions from text - https://github.com/adityasarvaiya/AutomaticQuestion_Generation
  • Summarize your video to any duration - https://github.com/aswanthkoleri/VideoMash and similar https://github.com/OpenGenus/vidsum
  • Tool for collectively summarizing large discussions - https://github.com/amyxzhang/wikum
  • AutoTL;DR bot for Lemmy) uses sumy: https://github.com/RikudouSage/LemmyAutoTldrBot

Β© 2026 GitRepoTrend Β· miso-belica/sumy Β· Updated daily from GitHub