PHP Science TextRank
Arabic & Turkish languages support
該原始程式碼是 TextRank 演算法在 PHP 程式語言中的實現,獲得 MIT 許可。
ChatGPT 等 GPT 是受監督的語言模型,可以理解上下文並使用大量資源從給定輸入生成新內容,而 TextRank 是一種經濟高效/低成本的文本提取演算法。 TextRank 演算法還可以用作 GPT 模型的預處理器,以減少文字大小以節省資源消耗。
自動摘要是使用電腦程式縮減文字文件以建立保留原始文件最重要要點的摘要的過程。能夠做出連貫摘要的技術會考慮長度、寫作風格和文法等變數。自動資料摘要是機器學習和資料探勘的一部分。概括的主要想法是找到資料的一個代表性的子集,它包含了整個集合的資訊。當今工業的許多部門都使用摘要技術。 - 維基百科
本次實現的演算法為:
cd your-project-folder
composer require php-science/textrank
cd git-project-folder
docker-compose build
docker-compose up -d
composer install
composer test
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 );
更多範例:
姓名 | GitHub 用戶 |
---|---|
大衛貝利查 | @大衛貝利扎 |
里卡多·馬頓 | @riccardomarton |
辛德西 | @辛德西 |
文森奇 | @vincentsch |
安德魯韋爾奇 | @khalwat |
安德烈·阿斯塔索夫 | @mvcaaa |
利奧·託內夫 | @布拉格 |
威利·阿里斯基 | @willyarisky |
羅伯特·揚·凱澤 | @KeizerDev |
莫蒂 | @邪惡1莫蒂 |
塞澤爾·菲丹西 | @SezerFidanci |