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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

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


Nov 30, 2012, 1:48 AM

Views: 5278
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?


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

				#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