Giter VIP home page Giter VIP logo

textrank's Introduction

summa - textrank

TextRank implementation for text summarization and keyword extraction in Python. An online version can be tested here.

Features

  • Text summarization
  • Keyword extraction
  • Text modeling with graph and gexf exportation

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. You must have them installed prior to installing summa:

pip install summa

If you are going to use the export function, you also need NetworkX. For a better performance of keyword extraction, install Pattern

This version has been tested under Python 2.7

More examples

  • Command-line usage:

    cd path/to/folder/summa/
    python textrank.py -t FILE
    
  • Export:

    >>> from summa.export import gexf_export
    >>> gexf_export(text, path="graph.gexf")
    
  • 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

textrank's People

Contributors

fbarrios avatar fedelopez77 avatar tkaria avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.