Skip to content

Instantly share code, notes, and snippets.

@scottwalters
Created March 18, 2014 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottwalters/9616686 to your computer and use it in GitHub Desktop.
Save scottwalters/9616686 to your computer and use it in GitHub Desktop.
use Text::Levenshtein::Damerau 'edistance';
my $text = qq{
Linen Finish Cards
I'd like to be able to order higher-quality card stock options, namely linen stock, similar to many playing card brands.
};
my @text = split m/\s+/, $text;
for my $word1 (@text) {
for my $word2 (qw/smaller hex tiles/) {
my $distance = edistance($word1, $word2);
print "$word1 -> $word2: ", edistance($word1, $word2), "\n" if $distance <= 2;
}
}
# be -> hex: 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment