定制 php-science/textrank 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

php-science/textrank

Composer 安装命令:

composer require php-science/textrank

包简介

TextRank (automatic text summarization) for PHP.

README 文档

README

TextRank

This source code is an implementation of TextRank algorithm in PHP programming language, under MIT licence.

TextRank vs. ChatGPT

GPTs like ChatGPT are supervised language models that understand the context and generate new content from the given input using vast resources while TextRank is a cost-efficient/low-cost text extraction algorithm. TextRank algorithm also can be used as a pre-processor to a GPT model to reduce the text size to save on resource consumption.

TextRank or Automatic summarization

Automatic summarization is the process of reducing a text document with a computer program in order to create a summary that retains the most important points of the original document. Technologies that can make a coherent summary take into account variables such as length, writing style and syntax. Automatic data summarization is part of machine learning and data mining. The main idea of summarization is to find a representative subset of the data, which contains the information of the entire set. Summarization technologies are used in a large number of sectors in industry today. - Wikipedia

The algorithm of this implementation is:

  • Extracts sentences,
  • Removes stopwords,
  • Adds integer values to words by finding and counting the matching words,
  • Weights the values of the words,
  • Normalizes values to get the scores,
  • Sorts by scores

Install to use it in your project

cd your-project-folder
composer require php-science/textrank

Install for contributing

cd git-project-folder
docker-compose build
docker-compose up -d
composer install
composer test

Examples

use PhpScience\TextRank\Tool\StopWords\English;

// String contains a long text, see the /res/sample1.txt file.
$text = "Lorem ipsum...";

$api = new TextRankFacade();
// English implementation for stopwords/junk words:
$stopWords = new English();
$api->setStopWords($stopWords);

// Array of the most important keywords:
$result = $api->getOnlyKeyWords($text); 

// Array of the sentences from the most important part of the text:
$result = $api->getHighlights($text); 

// Array of the most important sentences from the text:
$result = $api->summarizeTextBasic($text);

More examples:

Authors, Contributors

Name GitHub user
David Belicza @DavidBelicza
Riccardo Marton @riccardomarton
Syndesi @Syndesi
vincentsch @vincentsch
Andrew Welch @khalwat
Andrey Astashov @mvcaaa
Leo Toneff @bragle
Willy Arisky @willyarisky
Robert-Jan Keizer @KeizerDev
Morty @evil1morty
Sezer Fidancı @SezerFidanci

php-science/textrank 适用场景与选型建议

php-science/textrank 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.75M 次下载、GitHub Stars 达 245, 最近一次更新时间为 2016 年 08 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「automatic」 「strict」 「science」 「artificial」 「intelligence」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 php-science/textrank 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 php-science/textrank 我们能提供哪些服务?
定制开发 / 二次开发

基于 php-science/textrank 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.75M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 247
  • 点击次数: 27
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 245
  • Watchers: 11
  • Forks: 42
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-05