/**
  * Extract keywords from text
  *
  * @param string|null $text
  * @param bool|true   $withoutStopWords
  *
  * @return array
  */
 public function keywords($text = null, $withoutStopWords = true)
 {
     $config = new Config();
     if ($withoutStopWords) {
         $config->addListener(new Stopword());
     }
     $textRank = new TextRank($config);
     try {
         $keywords = $textRank->getKeywords($this->cleanup($text));
     } catch (\RuntimeException $e) {
         $keywords = null;
     }
     return is_array($keywords) ? array_keys($keywords) : $keywords;
 }
 public function extractKeywords($text = null, $limit = 15, $withoutStopWords = true)
 {
     if (!$text) {
         return;
     }
     $text = strtolower($text);
     $config = new Config();
     if ($withoutStopWords) {
         $config->addListener(new Stopword());
     }
     $textRank = new TextRank($config);
     try {
         $keywords = $textRank->getKeywords($this->_cleanupText($text));
     } catch (\RuntimeException $e) {
         $keywords = null;
     }
     if ($keywords == "") {
         $keywords = str_replace(' ', ',', $text);
     }
     return is_array($keywords) ? implode(", ", array_slice(array_keys($keywords), 0, $limit)) : $keywords;
 }