static public function readFreq(string $sep, array $ngrams) : array
    {
        $ngrams = self::ngramsAsArray($sep, $ngrams);
        $frequencies = array();
        foreach ($ngrams as $ngram) {
            foreach ($ngram as $pos => $token) {
                if(isset($frequencies[$token][$pos])) { //checks if the token in that position was already counted
                    $frequencies[$token][$pos] += 1;
                } else {
                    $frequencies[$token][$pos] = 1;
                }
            }
        }
        return $frequencies;
    }