Phpml\FeatureExtraction\StopWords::factory PHP 메소드

factory() 공개 정적인 메소드

public static factory ( string $language = 'English' ) : StopWords
$language string
리턴 StopWords
    public static function factory($language = 'English') : StopWords
    {
        $className = __NAMESPACE__ . "\\StopWords\\{$language}";
        if (!class_exists($className)) {
            throw InvalidArgumentException::invalidStopWordsLanguage($language);
        }
        return new $className();
    }

Usage Example

예제 #1
0
 public function testPolishStopWords()
 {
     $stopWords = StopWords::factory('Polish');
     $this->assertTrue($stopWords->isStopWord('wam'));
     $this->assertFalse($stopWords->isStopWord('transhumanizm'));
 }