PHP code example of phamluann / rake
1. Go to this page and download the library: Download phamluann/rake library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
phamluann / rake example snippets
$str = file_get_contents(__DIR__ . '/your-file');
hamLuann\Rake\Rake;
$str = file_get_contents(__DIR__ . '/src/stopword/text.txt');
$rake = new Rake($str);
$keyWords = $rake->getKeyword();
$result = '';
foreach ($keyWords as $keyWord => $score) {
$result .= $keyWord . ' ==> ' . $score . "\n\r";
}
echo $result;