Created
March 18, 2014 09:35
-
-
Save scottwalters/9616686 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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