JohnBeckett (talk | contribs) (Remove email address from author (you can put it back if you really want spam) + slight reword) |
JohnBeckett (talk | contribs) m (Word frenquency statistics for a file moved to Word frequency statistics for a file: Fix typo) |
Revision as of 07:38, 13 November 2007
Tip: Word frequency statistics for a file
Created: 2007-11-13 Complexity: advanced Author: vale.smth Version: 7.0
To generate a table of the occurrence frequency for every word in a file, just enter these commands.
:%s/\_A\+/\t1\r/g :sort i :g/\c\(.\+\)\n\1$/norm $yiwj@"^Akdd
In the above, ^A represents CTRL-A, and should be input directly (press CTRL-V then CTRL-A). On Windows, you would probably need to press CTRL-Q then CTRL-A, and you would probably first have to issue the command :unmap <C-A>.
Note that the above changes the file, so you would want to be working on a copy of your text, or you will need to undo the changes.
Comments
An amazing tip, but someone should briefly explain how it works.