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