in reply to Help finding mistakes in spellings using Perl

This is only a very indirect and hand-waving response and you probably already have looked at material like this, but this seems to be essentially the sort of thing that Levenshtein distance or Edit distance computations are processing, so you would only need to capture the bits and pieces of string that are being extracted by those algorithms to use for your own purposes. See Text::LevenshteinXS et al.

>perl -wMstrict -le "use Text::LevenshteinXS; ;; my $word = 'believe'; ;; for my $check (qw(believe relieve beleive beeliv pelief beehive)) { my $d = distance($word, $check); print qq{'$word' < $d > '$check'}; } " 'believe' < 0 > 'believe' 'believe' < 1 > 'relieve' 'believe' < 2 > 'beleive' 'believe' < 3 > 'beeliv' 'believe' < 3 > 'pelief' 'believe' < 3 > 'beehive'

Replies are listed 'Best First'.
Re^2: Help finding mistakes in spellings using Perl
by shamat (Acolyte) on Oct 10, 2013 at 15:41 UTC
    Hi Anomalous Monk, thanks for your reply. I was aware of the Levenstein distance module, but I don't see a way to capture the differences in spellings while processing the strings using that module - this is probably because of my poor knowledge of Perl.