src/Sentiment/Vader.php
/**
     * Normalize the score to be between -1 and 1 using an alpha that
     * approximates the max expected value
     * @param float $score
     * @param int $alpha
     * @return float
     */
Normalize the score to be between -1 and 1 using an alpha that
approximates the max expected value
@param float $score
@param int $alpha
@return float
Normalize the score to be between - 1 and 1 using an alpha that approximates the max expected value @param float $score @param int $alpha @return float
public function normalize(float $score, int $alpha=15) : float
    {
        $normalizedScore = $score;
        if (sqrt(($score^2) + $alpha) > 1) {
            $normalizedScore = $score/sqrt(($score^2) + $alpha);
        }
        if ($normalizedScore < -1.0) {
            return -1.0;
        } elseif ($normalizedScore > 1.0) {
            return 1.0;
        }
        return $normalizedScore;
    }
public function normalize ( float $ score , int $ alpha = 15 ) : float { $ normalizedScore = $ score ; if ( sqrt ( ( $ score ^ 2 ) + $ alpha ) > 1 ) { $ normalizedScore = $ score / sqrt ( ( $ score ^ 2 ) + $ alpha ) ; } if ( $ normalizedScore < - 1.0 ) { return - 1.0 ; } elseif ( $ normalizedScore > 1.0 ) { return 1.0 ; } return $ normalizedScore ; }
Normalize the score to be between -1 and 1 using an alpha that
 approximates the max expected value
 @param float $score
 @param int $alpha
 @return float
Normalize the score to be between - 1 and 1 using an alpha that approximates the max expected value @param float $score @param int $alpha @return float