public static function calculate(array $ngrams, string $measure, int $nGramSize = 2) : array
    {
        $totalNgrams = array_sum(array_column($ngrams, 0));
        return array_map( function($item) use($measure, $totalNgrams, $nGramSize) {
            if ($nGramSize == 2) {
                return Statistic2D::$measure($item, $totalNgrams);
            } elseif ($nGramSize == 3) {
                return Statistic3D::$measure($item, $totalNgrams);
            } else {
                throw new \Exception("Size of the ngram informed invalid", 1);
            }
        }, $ngrams);
    }