protected function getDefaultCommands()
 {
     // Keep the core default commands to have the HelpCommand
     // which is used when using the --help option
     $defaultCommands = parent::getDefaultCommands();
     $tokenizerFactory = new TokenizerFactory();
     $tokenizer = $tokenizerFactory->createDefaultTokenizer();
     $defaultCommands[] = new TokenizeCommand($tokenizer);
     return $defaultCommands;
 }
Пример #2
0
 /**
  * Constructor
  *
  * @return void
  * */
 public function __construct()
 {
     $stemmerFactory = new \Sastrawi\Stemmer\StemmerFactory();
     $this->stemmer = $stemmerFactory->createStemmer();
     $stopWordRemoverFactory = new \Sastrawi\StopWordRemover\StopWordRemoverFactory();
     $this->StopWordRemover = $stopWordRemoverFactory->createStopWordRemover();
     $sentenceDetectorFactory = new SentenceDetectorFactory();
     $this->sentenceDetector = $sentenceDetectorFactory->createSentenceDetector();
     $tokenizerFactory = new TokenizerFactory();
     $this->tokenizer = $tokenizerFactory->createDefaultTokenizer();
 }
Пример #3
0
 public function setUp()
 {
     $this->application = new Application();
     $tokenizerFactory = new TokenizerFactory();
     $this->tokenizer = $tokenizerFactory->createDefaultTokenizer();
     $this->application->add(new TokenizeCommand($this->tokenizer));
     $fp = fopen('php://memory', 'rw');
     fwrite($fp, 'Saya belajar NLP.');
     fseek($fp, 0);
     $this->command = $this->application->find('tokenize');
     $this->command->setInputStream($fp);
     $this->commandTester = new CommandTester($this->command);
 }
Пример #4
0
 /**
  * Initializes context.
  *
  * Every scenario gets its own context instance.
  * You can also pass arbitrary arguments to the
  * context constructor through behat.yml.
  */
 public function __construct()
 {
     $this->tokenizer = TokenizerFactory::createDefaultTokenizer();
 }
Пример #5
0
 public function testCreateDefaultTokenizer()
 {
     $factory = new TokenizerFactory();
     $this->assertInstanceOf('Sastrawi\\Tokenizer\\DefaultTokenizer', $factory->createDefaultTokenizer());
 }