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; }
/** * 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(); }
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); }
/** * 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(); }
public function testCreateDefaultTokenizer() { $factory = new TokenizerFactory(); $this->assertInstanceOf('Sastrawi\\Tokenizer\\DefaultTokenizer', $factory->createDefaultTokenizer()); }