Alex just asked me what letter is most common in the English language. I told him it was “e” (everyone knows that, right?) and following that is either “s” or “t”.
But I’m a curious kind of guy, and since I was sitting on the bed using my laptop anyway, I figured it wouldn’t be that hard to set up a series of shell commands that would do this for me. I knew how to access the spell-checking dictionary, and from there it was just a matter of chaining together the right pipes to take all of the words from the dictionary, break them down, and count the letters.
Here’s the command:
aspell -d en dump master | tr A-Z a-z | sed s/./”&\n”/g | grep [a-z] | sort | uniq -c | sort -nr
And the results:
It’s not surprising that “e” was on top, with “s” right behind, but I could’ve sworn “t” was more popular than that. Upon further thought, I suspect the data is a bit skewed because this is the dictionary and words like “the” only appear once. In spoken or written English, it appears much more often than words like, say, “phlegm”.
So to be more realistic, I should use a book instead of the dictionary. Of course I have a copy of Moby Dick handy… I use it for all of the testing I do in web sites. One change to the command above gives me the count from the novel instead:
cat moby-dick.txt | tr A-Z a-z | sed s/./”&\n”/g | grep [a-z] | sort | uniq -c | sort -nr
The answer? Things are a bit different:
Once again “e” trumps the rest, but now it’s “t” in second place and “s” has dropped down a bit. How odd. Even more interesting is the fact that “q” isn’t dead last– it’s 22nd. My theory on that: there’s a character in Moby Dick named Queequeg, and the mere mention of his name probably bumps the letter up the list.
This is hardly scientific, but all in all it’s a decent test. And yes, I’m a complete geek for taking three minutes to figure out how to do this.