Phpml\FeatureExtraction\StopWords::factory PHP Method

factory() public static method

public static factory ( string $language = 'English' ) : StopWords
$language string
return 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

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