divineomega / php-summary
PHP Summarization Library
Fund package maintenance!
DivineOmega
Installs: 25 541
Dependents: 1
Suggesters: 0
Security: 0
Stars: 32
Watchers: 5
Forks: 8
Open Issues: 0
Requires
- php: >=7.1
Requires (Dev)
- php-coveralls/php-coveralls: ^2.1
- phpunit/phpunit: ^7.0 || ^8.0
README
A PHP library to automatically summarise text using a naive summerisation algorithm.
This summerisation algorithm in use takes the key sentence from each paragraph. It then strings these resulting sentences together to form the summary.
For more details on this algorithm, see this blog post by Shlomi Babluki.
Installation
Require this package, with Composer, in the root directory of your project.
composer require divineomega/php-summary
Usage
To use PHP Summary, you should create a new SummaryTool
object, passing it the text content of your article. You can then call its getSummary
method to retrieve the shortened summary of the article.
Note: The article content must have its paragraphs seperated by two new line characters.
$summary = (new SummaryTool($content))->getSummary();