src/NGrams/Statistic2D.php
/**
    * Calculate the T-score
    * @param array $ngram Array of ngrams with frequencies
    * @return float Return the calculated value
    */
Calculate the T-score
@param array $ngram Array of ngrams with frequencies
@return float Return the calculated value
Calculate the T - score @param array $ngram Array of ngrams with frequencies @return float Return the calculated value
static public function tscore(array $ngram, int $totalNgrams) : float
    {
        $var = self::setStatVariables($ngram, $totalNgrams);
        $term1 = $var['jointFrequency'] - (($var['leftFrequency'] * $var['rightFrequency'])/$totalNgrams);
        $term2 = sqrt(($var['jointFrequency']));
        return ( $term1 / $term2 );
    }
static public function tscore ( array $ ngram , int $ totalNgrams ) : float { $ var = self :: setStatVariables ( $ ngram , $ totalNgrams ) ; $ term1 = $ var [ 'jointFrequency' ] - ( ( $ var [ 'leftFrequency' ] * $ var [ 'rightFrequency' ] ) / $ totalNgrams ) ; $ term2 = sqrt ( ( $ var [ 'jointFrequency' ] ) ) ; return ( $ term1 / $ term2 ) ; }
Calculate the T-score
 @param array $ngram Array of ngrams with frequencies
 @return float Return the calculated value
Calculate the T - score @param array $ngram Array of ngrams with frequencies @return float Return the calculated value