/ Published in: PHP
Credit for this code goes to the author, refer the discussion in stackoverflow.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $filename = "largefile.txt"; /* get content of $filename in $content */ /* split $content into array of substrings of $content i.e wordwise */ /* "stop words", filter them */ }); /* get associative array of values from $filteredArray as keys and their frequency count as value */ /* Sort array from higher to lower, keeping keys */ /* grab Top 10, huh sorted? */ /* display them */ foreach ($top10words as $topWord => $frequency) echo "$topWord -- $frequency<br/>"; ?>
URL: http://stackoverflow.com/questions/3169051/code-golf-word-frequency-chart