Пример #1
0
 public function __invoke($text, $sentences = 3)
 {
     $stripTags = $this->getView()->plugin('stripTags');
     $summarizer = new Summarizer();
     $summarizer->text = $stripTags($text);
     return $summarizer->summarize($sentences);
 }
Пример #2
0
 public function process()
 {
     $summarizer = new Summarizer();
     $summarizer->text = $this->post->content;
     $this->post->excerpt = $summarizer->summarize(3);
     $this->post->save();
 }