PHP SummarizerPHP Summarizer
Summarizer is a standalone PHP class that allows the quick creation of a summary for a given text or HTML page. Average rating of 3.5 based on 4 votesPHP Summarizer
Summarizer is a standalone PHP class that allows the quick creation of a summary for a given text... Average rating of 3.5Overview
This tool will give a summary for the given text by ranking each sentence by its relevance. The tool requires PHP to integrate in an existing project. Sample integration scripts are included in the package in order to facilitate the usage.
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 / 8 supported)
- Incredibly fast - in most cases, the summary is returned in less than 0.1 seconds
- Low memory usage - with regular articles less than 1 MB 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 / 8
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
-
Feb 13, 2022
-
Mar 12, 2021rickincabo PurchasedRating:
-
Feb 4, 2021
-
Dec 18, 2020codecide 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 | 22 September 2021 |
Software version | PHP 7.0, PHP 7.1, PHP 7.2, PHP 7.3, PHP 7.4, PHP 8.0, PHP 5.6 |
Tags | sentence, summary |