CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [Laurent_R] suggestions for spellchecker: Edit Log



Jurafsky
Novice

Nov 30, 2012, 1:48 AM


Views: 1961
Re: [Laurent_R] suggestions for spellchecker

I already tried but there are two problems :

1. the script reads each line of the input file many times (is there an error in the foreach loop?)
2. the script doesn't copy the right lines in the output file.

for this reason I thought it would be better to make a substitution in $word and then copy it in another scalar.. but then I've always the same problem: how can I create the new line?

Unsure


Got it !
if you have a better solution, please tell me!


Code
				#now I display the solutions and user can choose one of them 
print "These are the correction of word $word\n";
for (my $c = 0; $c < @correct; $c++) {
print "$c. : $correct[$c]\n";
}


print "Are you interested on one of this solution? Type the number or type 'exit'.\n";

$user = <STDIN>;
chomp ($user);

if ("$user" eq 'exit') {
print "Next word.\n";
}
else {
$line2 =~ s/$word/$correct[$user]/;
$word = $error;
@words = grep { $_ ne $error } @words;
}
}
}
print T2 "$line2 \n";
}



(This post was edited by Jurafsky on Nov 30, 2012, 3:53 AM)


Edit Log:
Post edited by Jurafsky (Novice) on Nov 30, 2012, 3:53 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives