Display the letters with their size proportional to their count. Compare English with other languages:
Note: adjust the scale factor by 100 if letters are too small or too big.
This makes a 100-point letter “A” (a point is a printer’s measure equal to 1/72 inch):
Style["A", 100]
This does the same thing using a pure function, which is indicated by # and &. A pure function is like a regular function, but it doesn’t have a name. The “A”—called the “argument”—is substituted for the # in the expression to the left of &:
Style[#, 100] &["A"]
You can give a pure function two arguments, like the letter and a size. The second argument is indicated in the pure function by #2:
Style[#, #2] &["A", 100]
Pure functions are often used to do something to every element of a list.
This makes every letter in the list the specified size:
Style[#, #2] & @@@ {{"A", 50}, {"B", 100}, {"C", 150}}
Use Row to get a row of letters without braces and commas:
Row[Style[#, #2] & @@@ {{"A", 50}, {"B", 100}, {"C", 150}}]
Do the same thing with the dictionary letter counts. First give the counts the name lettercounts:
lettercounts =
Tally[ToUpperCase[StringTake[DictionaryLookup[{"English", All}], 1]]]
Then size the letters using their counts. You need to divide the counts by 100 to get reasonable sizes:
Row[Style[#, #2/100] & @@@ lettercounts]
lettercounts =
Tally[ToUpperCase[
StringTake[DictionaryLookup[{"English", All}], 1]]];
Row[Style[#, #2/100] & @@@ lettercounts]