#!/usr/local/bin/perl
# parse & sort the output of wordPopular.pl
#

my @list = ();
open (PW, "<popular-words") || die "$!";
my $line;
while (defined($line = <PW>)) {
	if ($line =~ m/^(....) ([\d,]+)\n$/) {
		my $word = $1;
		my $value = $2;
		$value =~ s/,//g;
		push @list, [$word, $value];
	} else {
	}
}
@list = sort {$b->[1] <=> $a->[1]} @list;
@list = splice(@list, 0, 1024);
#print "have ".scalar(@list)." words.\n";

map { print "	\"".$_->[0]."\",\n"; } @list;
