You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
yooper edited this page Jun 30, 2016
·
3 revisions
Frequency Distributions with PHP Text Analysis
The frequency distribution is a great way to find out how frequently or in-frequently specific words are used in a body of text. The FreqDist class expects the tokens to be normalized prior to object instantiation.
$tokenizer = newGeneralTokenizer()
$tokens = $tokenizer->tokenize("time flies like an arrow and an arrow flies like time");
$freqDist = newFreqDist($tokens);
$freqDist->getHapaxes(); //Get the Hapaxes$freqDist->getTotalTokens()
$freqDist->getTotalUniqueTokens();