DavidBelicza / PHP-Science-TextRank

:zap: :elephant: TextRank (resource-efficient and low-cost automatic text summarisation) for PHP
https://php.science/textrank/
MIT License
243 stars 40 forks source link

Class 'TextRankFacade' not found #8

Closed MCKLtech closed 6 years ago

MCKLtech commented 6 years ago

Hi David,

I'm hitting this error:

Uncaught Error: Class 'TextRankFacade' not found in /home/cherevolution/public_html/feed/php-science/index.php:15 Stack trace: #0 {main} thrown

This is after a full successful build with Composer.

Current file:

require 'vendor/autoload.php';

use PhpScience\TextRank\Tool\StopWords\English;

// String contains a long text, see the /res/sample1.txt file.
$text = "Over the past fortnight ....
";

$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); 

print_r($result);

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

print_r($result);

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

print_r($result);

Edit: Composer tests are passing.

DavidBelicza commented 6 years ago

Hi, It seems TextRankFacade has not included by "use".

MCKLtech commented 6 years ago

Hi, It seems TextRankFacade has not included by "use".

Thank you David, unfortunately I'm not following. Do I have an error in my Use?

Edit:

DavidBelicza commented 6 years ago

Yes, you forgot use PhpScience\TextRank\TextRankFacade;.