tfe Homepage

04/04/2006

Correction check.pl

Juste pour afficher la mise e  jour de mon correcteur orthographique: J'ai changé l'algorithme "simpliste" du split ' ', par quelque chose d'un peu plus performant.

J'en profite donc pour ajouter les sources du site web en ligne. Vous pouvez doncévidemment retrouver le fichier check.pl le -bas.

my @checkit = (); my $current_word=""; foreach(split '',$word) { my $real = $_; $real =~ s/ /<br/>/g; if($real =~ /[^we¡e e«e©e¨e«e­e¬e¯e²e³e¶eºe¹e¼e¢eªe®e´u]/i) { if ($current_word && $speller->check($current_word)) { push(@checkit,$current_word); } elsif($current_word) { push(@checkit,"<span class=""bad"">$current_word</span>"); } $current_word = ""; push(@checkit,$real); } else { $current_word .= $real; } } if ($current_word && $speller->check($current_word)) { push(@checkit,$current_word); } elsif($current_word) { push(@checkit,"<span class=""bad"">$current_word</span>"); } push(@checkit,$real); my $retour = join("",@checkit); print $retour;