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





Overview
This tool will give a summary for the given text by ranking each sentence by its relevance.
Features
- Summary output with configurable threshold - only the lines with a frequency over the threshold will be returned
- Best words extraction - most relevant keyword will be extracted (ordered by their relevance)
- Sentences splitĀ - 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 (PHP 7 supported)
- 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
- Natural language processing - much better results when using non-standard languages (e.g. Russian, Farsi, Arabic, Chinese)
Requirements
PHP 5 / 7
Instructions
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.
Reviews
-
1 month agocodecide PurchasedRating:Excellent code and functionality. Exactly as described and what I was hoping for.
Information
Category | Scripts & Code / PHP Scripts / Miscellaneous |
First release | 3 January 2020 |
Last update | 6 January 2020 |
Software version | PHP 7.0, PHP 7.1, PHP 7.2, PHP 7.3, PHP 7.4, PHP 5.6 |
Tags | summarize, summarizer, sentences |