Exemplo n.º 1
0
 /**
  * Handle the parse for given text.
  *
  * @param string $text
  * @param bool   $runPlugins
  *
  * @return LimelightResults
  */
 public function handle($text, $runPlugins)
 {
     $node = $this->mecab->parseToNode($text);
     $tokens = $this->tokenizer->makeTokens($node);
     $words = $this->tokenParser->parseTokens($tokens);
     $pluginResults = $runPlugins ? $this->runPlugins($text, $node, $tokens, $words) : null;
     $results = new LimelightResults($text, $words, $pluginResults);
     $this->dispatcher->fire('ParseWasSuccessful', $results);
     return $results;
 }
Exemplo n.º 2
0
 /**
  * Parse string, return mecab results as string.
  *
  * @param string $string
  *
  * @return string
  */
 public function parseToString($string)
 {
     return $this->mecab->parseToString($string);
 }