How can I find the words I type most frequently?

11,081

Sounds like you'd love AutoHotkey's AutoCorrect script.

The following script uses hotstrings to correct about 4700 common English misspellings on-the-fly. It also includes a Win+H hotkey to make it easy to add more misspellings

If you really want to know what your most commonly typed words are:

1.) Grab a keylogger that will log to flat files in a plain text format, such as pykeylogger. Note that it can also use delimiters for easier parsing such as CSV. Run it for a day or however long you want until you have enough data to make your word preference more obvious.

2.) And then use this simple program I quickly threw together to count the words (assumes CSV file):

#!/usr/bin/perl

use warnings;
use strict;
my %unique = ();

open FH,"< data.txt" or die $!;

while (<FH>)
{
  chomp;
  my @words = split/,/,$_;
  foreach(@words)
  {
      $unique{$_}++;
  }
}

close FH;

foreach(reverse sort {$unique{$a} <=> $unique{$b}} keys %unique)
{
    print "$_ => $unique{$_}\n";
}

That will go through each line in a CSV format file, and create a hash containing every word in the file along with how many times it occurs.

Sample input:

test,test,test,word,test,other,something,test
something,test,word,test,test
word,test

Sample output:

john@awesome:~$ chmod +x count.pl
john@awesome:~$ ./count.pl
test => 9
word => 3
something => 2
other => 1
Share:
11,081

Related videos on Youtube

Craig
Author by

Craig

Committer for the Eclipse Collections Java collections framework (formerly GS Collections). Fan of static languages like Scala and Haskell. Talks about GS Collections, Java, and Scala: QCon NY 2014 Parallel-lazy Performance: Java 8 vs Scala vs GS Collections Scala Days 2015 Scala Collections Performance GOTO Chicago 2015 GS Collections and Java 8: Functional, Fluent, Friendly, and Fun

Updated on September 17, 2022

Comments

  • Craig
    Craig almost 2 years

    Many programs can save you some typing by setting up shortcuts for commonly typed words. For example you could always replace @gm with @gmail.com. I'm having trouble coming up with a list of things I type frequently and I'm looking for an automated way to discover good candidates.

  • Sasha Chedygov
    Sasha Chedygov almost 14 years
    That's the most readable Perl code I've ever seen. :)