Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Summarize – Powerful Text Summarization in Ruby

By Peter Cooper / December 6, 2010

Automatic text summarization is the technique where a computer program summarizes a document. A text is put into the computer and a highlighted (summarized) text is returned. The Open Text Summarizer is an open source tool for summarizing texts. The program reads a text and decides which sentences are important and which are not.

Nadav Rotem

Summarize is a new Ruby library that provides bindings to the C-based Open Text Summarizer library. It's an ideal way to get a "summary" of a document and esteemed Rubyist Jeremy McAnally used it in his RailsRumble-winning app

Once installed (gem install summarize - if you're lucky and have the dependencies), Summarize is easy to use since it adds a summarize method to the String class:

your_string.summarize(:ratio => 25)

In this case, Summarize returns a summary approximately 25% of the length of the original string in your_string.


  1. Sean Soper says:

    Thanks for the great write-up. FYI, I've just released a new version of the gem (1.0.3) which now can return topics as well.

  2. Avinash says:

    How do i install it in a mac. i use rvm ruby 1.9.2. when i did a gem install summarize it thows an error glib.h is not found. ports couldn find a glib . Any idea ?

  3. Peter Cooper says:

    Odd.. you surely have the XCode stuff all installed, right? (I don't think RVM works without them..)

    FWIW, I installed on OS X with no issues at all - very quick and clean. Might give it a go with 1.9.2 though as I did it just on the stock Ruby. Hmm.. just went without a hitch too..

Other Posts to Enjoy

Twitter Mentions