public function percentage(string $needle) : float
    {
        $freqDist = freq_dist($this->getTokens());
        return $freqDist->getKeyValuesByFrequency()[$needle] / $freqDist->getTotalTokens();
    }
public function percentage(string $needle) : float
    {
        $freqDist = freq_dist($this->getTokens());
        return $freqDist->getKeyValuesByFrequency()[$needle] / $freqDist->getTotalTokens();
    }
public function percentage ( string $ needle ) : float { $ freqDist = freq_dist ( $ this -> getTokens ( ) ) ; return $ freqDist -> getKeyValuesByFrequency ( ) [ $ needle ] / $ freqDist -> getTotalTokens ( ) ; }
Get percentage of times the needle shows up in the text
@param string $needle
@return float
Get percentage of times the needle shows up in the text