public function applyStemmer(IStemmer $stemmer, $removeNulls = true) 
    {        
        foreach($this->tokens as &$token) 
        { 
            $token = $stemmer->stem($token);
        }
        
        if($removeNulls) {
            //filter null tokens and re-index
            $this->tokens = array_values(array_filter($this->tokens));            
        }
        return $this;
    }
public function applyStemmer(IStemmer $stemmer, $removeNulls = true) 
    {        
        foreach($this->tokens as &$token) 
        { 
            $token = $stemmer->stem($token);
        }
        
        if($removeNulls) {
            //filter null tokens and re-index
            $this->tokens = array_values(array_filter($this->tokens));            
        }
        return $this;
    }
public function applyStemmer ( IStemmer $ stemmer , $ removeNulls = true ) { foreach ( $ this -> tokens as & $ token ) { $ token = $ stemmer -> stem ( $ token ) ; } if ( $ removeNulls ) { //filter null tokens and re-index $ this -> tokens = array_values ( array_filter ( $ this -> tokens ) ) ; } return $ this ; }
Apply a stemmer
@param IStemmer $stemmer
@param boolean $removeNulls
@return \TextAnalysis\Documents\TokensDocument
Apply a stemmer