All pastes #562980 Raw Edit

Something

public php v1 · immutable
·published 2007-06-12 23:50 UTC
rendered paste body
<?phpfunction natrsort (&$array)	{	natsort($array);	$array = array_reverse($array, true);	}function read_file($filename)	{	$open = @fopen($filename, 'r');	$size = @filesize($filename);	$read = @fread($open, $size);	@fclose($open);	return $read;	}$file = read_file($argv[1]);$threshold = $argv[2];$file = strtolower(strip_tags(preg_replace('/\s/', '___', $file)));$file = preg_replace("/'/", '_', $file);$file = preg_replace('/\W/', '$1', $file);$file = str_replace('___', ' ', $file);$file = str_replace('_', '\'', $file);$words_array = explode(' ', $file);$words = array();foreach ($words_array as $word)	{	$words[$word]++;	}natrsort($words);$blacklist = array	(	'the' => true,	'be' => true,	'to' => true,	'of' => true,	'and' => true,	'a' => true,	'in' => true,	'that' => true,	'have' => true,	'i' => true,	'it' => true,	'for' => true,	'not' => true,	'on' => true,	'with' => true,	'he' => true,	'as' => true,	'you' => true,	'do' => true,	'at' => true,	'this' => true,	'but' => true,	'his' => true,	'by' => true,	'from' => true,	'they' => true,	'we' => true,	'say' => true,	'her' => true,	'she' => true,	'or' => true,	'an' => true,	'will' => true,	'my' => true,	'one' => true,	'all' => true,	'would' => true,	'their' => true,	'there' => true,	'what' => true,	'so' => true,	'up' => true,	'out' => true,	'if' => true,	'about' => true,	'who' => true,	'get' => true,	'which' => true,	'go' => true,	'me' => true	);$blacklist[array_values($blacklist)] = $blacklist;foreach ($words as $word => $num)	{	if (!($num >= $threshold))		{		break;		}	if (empty($word) or $blacklist[$word])		{		continue;		}	echo ('"' . $word . '" appears ' . $num . ' times' . "\n");	}?>