Earlier quoted context omitted.
Just did it for 28000 C files. Here's the results: a 0.772163 b 1.2679 c 1.78209 d 1.1195 e 0.881398 f 1.47252 g 0.924242 h 0.358954 i 1.06756 j 0.835313 k 1.41458 l 0.981729 m 1.08955 n 0.9156 o 0.73849 p 1.74468 q 4.2497 r 1.21577 s 1.05023 t 1.03627 u 1.2967 v 1.77662 w 0.396003 x 13.7292 y 0.47566 z 3.78748 The numbers are (relative frequency in C) / (relative frequency in English). So "b" is slightly more common…
Do you know why you have slightly different numbers of (){}[] characters? In C or C++ shouldn't those all be paired up to match?
Most Pressed Keys and Programming Syntaxes
91–99 of 99 posts
Re: Most Pressed Keys and Programming Syntaxes
#92Re: Most Pressed Keys and Programming Syntaxes
#93Earlier quoted context omitted.
Do you know why you have slightly different numbers of (){}[] characters? In C or C++ shouldn't those all be paired up to match?
It can probably be accounted for by comments (e.g. people sometimes comment out half a block). Although the comments should be left out, so as not to mix the C and the English.
if (c == '{')
and not need to test for the matching one.Re: Most Pressed Keys and Programming Syntaxes
#94Earlier quoted context omitted.
Just did it for 28000 C files. Here's the results: a 0.772163 b 1.2679 c 1.78209 d 1.1195 e 0.881398 f 1.47252 g 0.924242 h 0.358954 i 1.06756 j 0.835313 k 1.41458 l 0.981729 m 1.08955 n 0.9156 o 0.73849 p 1.74468 q 4.2497 r 1.21577 s 1.05023 t 1.03627 u 1.2967 v 1.77662 w 0.396003 x 13.7292 y 0.47566 z 3.78748 The numbers are (relative frequency in C) / (relative frequency in English). So "b" is slightly more common…
Could I ask for one more data: the total number of characters and maybe lines? That way symbol/alpha/line ratios could be compared to other languages.
Finder reports 630,942,867 bytes for the whole directory. Assuming most files will be plain ASCII, that should give a good approximation for the total number of characters.
Re: Most Pressed Keys and Programming Syntaxes
#95Earlier quoted context omitted.
Could I ask for one more data: the total number of characters and maybe lines? That way symbol/alpha/line ratios could be compared to other languages.
Yeah, when I get a chance I'll gather together some stats on all the languages I have data on (about 40). Finder reports 630,942,867 bytes for the whole directory. Assuming most files will be plain ASCII, that should give a good approximation for the total number of characters.
* 18% of all characters are symbols, 12% are spaces and 70% are alphabetic
* 20% of all non-space characters are symbols and 80% are alphabetic.
* US kb layout users need to use shift for 64% of symbols
* Finnish/Swedish kb layout users need to use shift for 73% of symbols and AltGr for 7% of symbols.
* Fi/Swe layout users thus need to use 25% more modifer keys for symbols.
Conclusion: Fi/Swe layout sucks.
edit: https://gist.github.com/1205728 python script used to get these numbers (percentages calculated with OOo Calc).
Re: Most Pressed Keys and Programming Syntaxes
#96it'd be interesting to see these heatmaps in some sort of normalized way. for example, 'e' is the most common letter in english, so its the most commonly used letter in these programming languages. it'd be very interesting to see, for example, this heatmap with the intensities divided by each letter's frequency of use in the English language, or across a large set of data including a lot of different programming lang…
Just did it for 28000 C files. Here's the results: a 0.772163 b 1.2679 c 1.78209 d 1.1195 e 0.881398 f 1.47252 g 0.924242 h 0.358954 i 1.06756 j 0.835313 k 1.41458 l 0.981729 m 1.08955 n 0.9156 o 0.73849 p 1.74468 q 4.2497 r 1.21577 s 1.05023 t 1.03627 u 1.2967 v 1.77662 w 0.396003 x 13.7292 y 0.47566 z 3.78748 The numbers are (relative frequency in C) / (relative frequency in English). So "b" is slightly more common…
Re: Most Pressed Keys and Programming Syntaxes
#97it'd be interesting to see these heatmaps in some sort of normalized way. for example, 'e' is the most common letter in english, so its the most commonly used letter in these programming languages. it'd be very interesting to see, for example, this heatmap with the intensities divided by each letter's frequency of use in the English language, or across a large set of data including a lot of different programming lang…
For this reason, I think it would have been more interesting to ignore the alphabet keys and just heatmap the rest.
Based on alextgordons numbers (see http://news.ycombinator.com/item?id=2974381 )