[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.2.6-70-gfb345e4



The following commit has been merged in the master branch:
commit 8baffbd49e1045fdfa85459e6bf2b62325638ab3
Author: Raphael Geissert <atomo64@gmail.com>
Date:   Tue Feb 24 23:21:11 2009 -0600

    Optimise the spell checking algorithm

diff --git a/lib/Spelling.pm b/lib/Spelling.pm
index 7de06c0..8c4cdbf 100644
--- a/lib/Spelling.pm
+++ b/lib/Spelling.pm
@@ -429,23 +429,17 @@ sub spelling_check {
     my ($tag, $text, $filename) = @_;
     return unless $text;
 
-    for my $word (split(/\s+/, $text)) {
-        $word = lc $word;
+    $text = lc $text;
+    $text =~ s/[.,;:?!()[\]-]//g;
 
-        # Try deleting the non-alphabetic parts from the word.  Treat
-        # apostrophes specially: only delete them if they occur at the
-        # beginning or end of the word.
-        #
-        # FIXME: Should do something that's aware of Unicode character
-        # classes rather than only handling ISO 8859-15 characters.
-        $word =~ s/(^\')|[^\w\xc0-\xd6\xd8-\xf6\xf8-\xff\'-]+|(\'\z)//g;
+    for my $word (split(/\s+/, $text)) {
         if (exists $CORRECTIONS{$word}) {
             _tag($tag, $filename, $word, $CORRECTIONS{$word});
         }
     }
 
     # Special case for correcting a multi-word string.
-    if ($text =~ m,Debian/GNU\s+Linux,) {
+    if ($text =~ m,debian/gnu\s+linux,) {
         _tag($tag, $filename, "Debian/GNU Linux", "Debian GNU/Linux");
     }
 }

-- 
Debian package checker


Reply to: