static public function readCombFreq(string $sep, array $ngrams) : array
    {
        $ngrams = self::ngramsAsArray($sep, $ngrams);
        $frequencies = array();
        foreach ($ngrams as $ngram) {
            foreach ($ngram as $posToken => $token) {
                for ($i = $posToken+1; $i < count($ngram); $i++) {
                    if(isset($frequencies[$token.$sep.$ngram[$i]][$posToken][$i])) { //checks if the combo already exists
                        $frequencies[$token.$sep.$ngram[$i]][$posToken][$i] += 1;
                    } else {
                        $frequencies[$token.$sep.$ngram[$i]][$posToken][$i] = 1;
                    }
                }
            }

        }
        return $frequencies;
    }
static public function readCombFreq(string $sep, array $ngrams) : array
    {
        $ngrams = self::ngramsAsArray($sep, $ngrams);
        $frequencies = array();
        foreach ($ngrams as $ngram) {
            foreach ($ngram as $posToken => $token) {
                for ($i = $posToken+1; $i < count($ngram); $i++) {
                    if(isset($frequencies[$token.$sep.$ngram[$i]][$posToken][$i])) { //checks if the combo already exists
                        $frequencies[$token.$sep.$ngram[$i]][$posToken][$i] += 1;
                    } else {
                        $frequencies[$token.$sep.$ngram[$i]][$posToken][$i] = 1;
                    }
                }
            }

        }
        return $frequencies;
    }
static public function readCombFreq ( string $ sep , array $ ngrams ) : array { $ ngrams = self :: ngramsAsArray ( $ sep , $ ngrams ) ; $ frequencies = array ( ) ; foreach ( $ ngrams as $ ngram ) { foreach ( $ ngram as $ posToken => $ token ) { for ( $ i = $ posToken + 1 ; $ i < count ( $ ngram ) ; $ i ++ ) { if ( isset ( $ frequencies [ $ token . $ sep . $ ngram [ $ i ] ] [ $ posToken ] [ $ i ] ) ) { //checks if the combo already exists $ frequencies [ $ token . $ sep . $ ngram [ $ i ] ] [ $ posToken ] [ $ i ] += 1 ; } else { $ frequencies [ $ token . $ sep . $ ngram [ $ i ] ] [ $ posToken ] [ $ i ] = 1 ; } } } } return $ frequencies ; }
Counts the frequency of combo of tokens of an ngram array
@param string $sep
@param array $ngrams
@return array $frequencies Return an array of a combo of tokens with its frequencies by its positions
Counts the frequency of combo of tokens of an ngram array