public function getPolarityScores(array $tokens) : array
    {
        $sentiments = [];
        for($index = 0; $index < count($tokens); $index++)
        {
            $valence = 0.0;
            $lcToken = strtolower($tokens[$index]);
            if( $lcToken === "kind" && strtolower($tokens[$index+1]) === 'of' ||
                isset(self::$this->boosterDict[$lcToken]) ) {   
                
                $sentiments[] = $valence;
            } else {
                $sentiments[] = $this->getSentimentValence($valence, $tokens, $index, $sentiments);
            }
        }

        $sentiments = $this->butCheck($tokens, $sentiments);        
        return $this->scoreValence($sentiments, $tokens);
    }
public function getPolarityScores(array $tokens) : array
    {
        $sentiments = [];
        for($index = 0; $index < count($tokens); $index++)
        {
            $valence = 0.0;
            $lcToken = strtolower($tokens[$index]);
            if( $lcToken === "kind" && strtolower($tokens[$index+1]) === 'of' ||
                isset(self::$this->boosterDict[$lcToken]) ) {   
                
                $sentiments[] = $valence;
            } else {
                $sentiments[] = $this->getSentimentValence($valence, $tokens, $index, $sentiments);
            }
        }

        $sentiments = $this->butCheck($tokens, $sentiments);        
        return $this->scoreValence($sentiments, $tokens);
    }
public function getPolarityScores ( array $ tokens ) : array { $ sentiments = [ ] ; for ( $ index = 0 ; $ index < count ( $ tokens ) ; $ index ++ ) { $ valence = 0.0 ; $ lcToken = strtolower ( $ tokens [ $ index ] ) ; if ( $ lcToken === "kind" && strtolower ( $ tokens [ $ index + 1 ] ) === 'of' || isset ( self :: $ this -> boosterDict [ $ lcToken ] ) ) { $ sentiments [ ] = $ valence ; } else { $ sentiments [ ] = $ this -> getSentimentValence ( $ valence , $ tokens , $ index , $ sentiments ) ; } } $ sentiments = $ this -> butCheck ( $ tokens , $ sentiments ) ; return $ this -> scoreValence ( $ sentiments , $ tokens ) ; }
Return a float for sentiment strength based on the input text.
Positive values are positive valence, negative value are negative valence.
@param array $tokens
Return a float for sentiment strength based on the input text . Positive values are positive valence negative value are negative valence .