digininja / CeWL

CeWL is a Custom Word List Generator
2.01k stars 262 forks source link

[Feature Request] Add frequency sort option #67

Open g0tmi1k opened 4 years ago

g0tmi1k commented 4 years ago

So there is:

-c, --count: Show the count for each word found.

Could this be expanded at all, so another option, would just sort the list by frequency? The words/phrases that appear the most, at the top, least/unique values at the end? (and without the count?)

I know this can be done easy afterwards, just would be 'nice' to have it in-built

digininja commented 4 years ago

it already does sort by frequency, the --count just adds the count to the output:

1067     sorted_wordlist = word_hash.sort_by do |word, count|
1068         -count
1069     end
1070 
1071     sorted_wordlist.each do |word, count|
1072         if show_count
1073             outfile_file.puts "#{word}, #{count.to_s}"
1074         else
1075             outfile_file.puts word
1076         end
1077     end