Summarize – Powerful Text Summarization in Ruby
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 TLDR.it.
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.
December 6, 2010 at 4:25 pm
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.
December 11, 2010 at 8:10 am
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 ?
December 11, 2010 at 8:15 am
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..