Skip to content

Instantly share code, notes, and snippets.

@windytan
Created March 26, 2013 16:00
Show Gist options
  • Save windytan/5246589 to your computer and use it in GitHub Desktop.
Save windytan/5246589 to your computer and use it in GitHub Desktop.
$|++;
use warnings;
use Text::LevenshteinXS qw(distance);
for (qx!cat nappis.txt!) {
$merkki{$2} = $1 if (/^(.+) ([01]+)/);
}
while (<>) {
chomp();
$pienin = "";
for $vertai (keys %merkki) {
$pienin = $vertai if ($pienin eq "" or distance($_, $vertai) <= distance($_, $pienin));
}
print ($merkki{$pienin} // "");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment