Important facts about commercial licenses

  • Licenses are perpetual. They do not expire and do not need to be renewed.
  • Licenses can be upgraded. You can upgrade to a more expensive license later paying only the difference in cost.
  • Pay attention to the distribution type - Hosted (sites / servers), binary (applications) or source (includes all the others). Choose according to your needs (more below).
  • All licenses allow commercial use unless otherwise indicated.
  • Read the full license by clicking on the icon.
  • Read more about licenses in our handy license guide.
$14

Personal License

1 site, unlimited servers No source distribution
$59

Developer License

Unlimited projects Source and binary distribution
You need to log-in or create an account
  • Create an account
  • Log-in
  • Please use your real name.
  • Account activation link will be sent to this address.
  • Minimum 8 characters

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

  • Released: Feb 7, 2011
    Last Update: Apr 18, 2013
  • Language: PHP
  • Time / costs savings: 10h / $600 *

PHP Summarizer

PHP Summarizer
Developed by Cristian Radu, Released Feb 7, 2011

Summarizer is a standalone PHP class that allows the quick creation of a summary for a given text or HTML page.

PHP

Tags: contest2011 , extract , summarize , summary

This tool will give a summary for the given text by ranking each sentence by its relevance.

Features

  • Summary output with configurable treshold - only the lines with a frequency over the treshold will be returned
  • Best words extraction - most relevant keyword will be extracted (ordered by their relevance)
  • Sentences splitter - the given text is automatically split into sentences
  • Common words skip - in order to provide better results, common words are skipped based on a dictionary (only for English language provided)
  • Minimal dependencies - all you need is PHP 5 to run it
  • Incredibly fast - in most cases, the summary is returned in less than 0.1 seconds
  • Low memory usage - with regular articles less than 1MB of memory is used
Back to top

Documentation

Basic usage

Here is how to create the summary of a given text.

From local file:

require_once(dirname(__FILE__) . '/Summarizer.php');

$text = file_get_contents(dirname(__FILE__) . '/test_files/cap1.txt');
$summarizer = new Summarizer();
$summarizer->loadText($text);
$summary = $summarizer->run();
print_r($summary);

From remote url:

require_once(dirname(__FILE__) . '/Summarizer.php');

$url = 'http://edition.cnn.com/2011/LIVING/02/07/russell.simmons.super.rich/index.html?hpt=C2';
$summarizer = new Summarizer();
$summarizer->loadUrl($url);
$summary = $summarizer->run();
print_r($summary);

API documentation

To view all of the available class methods take a look at the API reference.

If you are looking for a demo of the Summarizer script you can find here a fully working summarizer.

User Reviews

No reviews have been submitted yet.
Read all 10 comments »

Questions & Comments


Or enter your name and Email
  • Mick89 License holderPersonal License 2 years ago
    In Fact, he does not work for me:

    The words like "été", "étrangers" give "t" and "trangers".

    An idea?

    Thanks!

    Mick
    • Cristian Radu Developer 2 years ago
      It seems there was a bug with some UTF-8 characters when they were converted to HTML - for example é is translated into é - and they were stripped wrong by the summarizing script.

      I will make a new release for this bug fix soon. It's been updated on the demo page, so you can check that out.
  • Mick89 License holderPersonal License 2 years ago
    Hi,

    Can It work with the foreign characters or UTF8?

    Thanks,

    Mick
    • Cristian Radu Developer 2 years ago
      Yes, it uses UTF8 encoding so it works with foreign characters as well. You can test it yourself using the demo: http://www.tools4noobs.com/summarize/

      Please note the common words are stripped for more accuracy, however those words are for English in the demo (it can be customized though).
    • Mick89 License holderPersonal License 2 years ago
      Hi,

      Do You think that I can exclude the word foreigners (à, où...) ?

      Thank You for your assistance.

      Mick
    • Cristian Radu Developer 2 years ago
      Hello Mick,

      Sure, you can exclude any words you consider non relevant.

      All you need to do is to open the file library/skip.txt and add them each on a new line.

      For example:

      ...
      were
      said
      à

    • Mick89 License holderPersonal License 2 years ago
      Thank You for your answer!

      Do You have examples?

      I tested:
      $summarizer = new Summarizer($first_best);
      $summarizer->loadUrl($url);
      $summary = $summarizer->run();
      print_r($summary);

      ...but, that does not function.

      Thanks again!

      Mick
    • Cristian Radu Developer 2 years ago
      You have full working examples in the tests/ folder.

      Also, some simple examples are presented on the Binpress page: http://www.binpress.com/app/php-summarizer/87#documentation

      You will probably need something like:

      require_once('/path/to/Summarizer.php');

      $url = 'http://edition.cnn.com/2011/LIVING/02/07/russell.simmons.super.rich/index.html?hpt=C2';
      $summarizer = new Summarizer();
      $summarizer->loadUrl($url);
      $summary = $summarizer->run();
      print_r($summary);
    • Mick89 License holderPersonal License 2 years ago
      Thank You.

      In Fact, I would like to obtain the lites of the best words.

      Is It possible?

      Your example gives only the summary.

      Mick
    • Mick89 License holderPersonal License 2 years ago
      Oops! I did not read the file readme.txt.

      I read only the file documentation.txt.

      Excuse me!

      Mick
You must be logged-in to vote. Log-in to your account or register now.