src/NGrams/NGramFactory.php
/**
    * 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
@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 @param string $sep @param array $ngrams @return array $frequencies Return an array of a combo of tokens with its frequencies by its positions
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])) { 
                        $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 ] ) ) { $ 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 @param string $sep @param array $ngrams @return array $frequencies Return an array of a combo of tokens with its frequencies by its positions
//checks if the combo already exists