Exemplo n.º 1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $analyzer = $this->argument('analyzer');
     $text = $this->argument('text');
     $indexName = $this->option('index') ?: $this->indexManager->getDefaultIndex();
     $dump = $this->option('dump') ? true : false;
     $filters = $this->option('filter') ? explode(',', $this->option('filter')) : [];
     $tokenizer = $this->option('tokenizer');
     $results = $this->indexManager->analyze($analyzer, $text, $filters, $tokenizer, $indexName);
     if ($dump) {
         (new Dumper())->dump($results);
     } else {
         $this->printTokens($results['tokens']);
     }
 }