Skip to main content

A text summarization and keyword extraction package based on textrank

Project description

TextRank implementation for text summarization and keyword extraction in Python.

Features

  • Text summarization

  • Keyword extraction

Examples

Text summarization:

>>> text = """Automatic summarization is the process of reducing a text document with a
computer program in order to create a summary that retains the most important points
of the original document. As the problem of information overload has grown, and as
the quantity of data has increased, so has interest in automatic summarization.
Technologies that can make a coherent summary take into account variables such as
length, writing style and syntax. An example of the use of summarization technology
is search engines such as Google. Document summarization is another."""

>>> from summa import summarizer
>>> print summarizer.summarize(text)
'Automatic summarization is the process of reducing a text document with a computer
program in order to create a summary that retains the most important points of the
original document.'

Keyword extraction:

>>> from summa import keywords
>>> print keywords.keywords(text)
document
automatic summarization
technologies
technology

Installation

This software depends on NumPy and Scipy, two Python packages for scientific computing. Pip will automatically install them along with summa:

pip install summa

For a better performance of keyword extraction, install Pattern

More examples

  • Command-line usage:

    textrank -t FILE
  • Define length of the summary as a proportion of the text (also available in keywords):

    >>> from summa.summarizer import summarize
    >>> summarize(text, ratio=0.2)
  • Define length of the summary by aproximate number of words (also available in keywords):

    >>> summarize(text, words=50)
  • Define input text language (also available in keywords):

    >>> summarize(text, language='spanish')

The available languages are “danish”, “dutch”, “english”, “finnish”, “french”, “german”, “hungarian”, “italian”, “norwegian”, “porter”, “portuguese”, “romanian”, “russian”, “spanish”, “swedish”

  • Get results as a list (also available in keywords):

    >>> summarize(text, split=True)
    ['Automatic summarization is the process of reducing a text document with a
    computer program in order to create a summary that retains the most important
    points of the original document.']

Summa is open source software released under the The MIT License (MIT). Copyright (c) 2014 - now Summa NLP

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

summa-0.1.0.tar.gz (44.0 kB view details)

Uploaded Source

File details

Details for the file summa-0.1.0.tar.gz.

File metadata

  • Download URL: summa-0.1.0.tar.gz
  • Upload date:
  • Size: 44.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for summa-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cf986ccead5a7e23f036892d68c2e89764fda24836a66ddf51e04f9ce67dbc78
MD5 38d6cac1e3544cd4fec4ebfb26d3b722
BLAKE2b-256 966126d9c2dce31acfe534c4d07c82afdad2e121fd173e06b61089da70aabb66

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page