assertchris/ellison

一个简单的库,帮助识别复杂句子和不佳的词汇选择

1.0.2 2024-05-10 14:14 UTC

This package is auto-updated.

Last update: 2024-09-22 04:15:47 UTC


README

Ellison是一个简单的库,帮助识别复杂句子和不佳的词汇选择。它使用与Hemingway类似的启发式方法,但不包含任何第三方API或LLM的调用。只是简单的PHP。

您可以使用以下命令安装它

composer require assertchris/ellison

...并且,您可以这样使用它

$ellison = new AC\Ellison\Ellison();

$ellison->getSentenceDifficulty('This is a paragraph of text. It may include some moderately complex sentences, with slightly complex words. It might also include verbose sentences that tax the brain, tire the eyes, and exhaust the brain; all in an attempt to make the writer sound amazing.');

//  => [
//   [text => 'This is...of text', type => 'simple']
//   [text => 'It may...complex words', type => 'moderate']
//   [text => 'It might...sound amazing', type => 'complex']
// ]

$ellison->getPassivePhrases('This sentence may have been written by a corgi');

// => [
//   [text => 'been written', type => 'passive'] 
// ]

欢迎提交PR以添加您感兴趣的更多短语和词汇。目前我没有支持非英语语言的兴趣。