Parcourir la source

use is_nick instead of find_alias if we just want to know if it's a nick or not....

sbingner il y a 24 ans
Parent
commit
8a803661c5
2 fichiers modifiés avec 15 ajouts et 13 suppressions
  1. 2 2
      modules/Pisg/HTMLGenerator.pm
  2. 13 11
      modules/Pisg/Parser/Logfile.pm

+ 2 - 2
modules/Pisg/HTMLGenerator.pm

@@ -1498,7 +1498,7 @@ sub _mostusedword
 
 
     foreach my $word (keys %{ $self->{stats}->{wordcounts} }) {
     foreach my $word (keys %{ $self->{stats}->{wordcounts} }) {
         # Skip people's nicks.
         # Skip people's nicks.
-        next if exists $self->{stats}->{lines}{$word};
+        next if is_nick($word);
         next if (length($word) < $self->{cfg}->{wordlength});
         next if (length($word) < $self->{cfg}->{wordlength});
         $usages{$word} = $self->{stats}->{wordcounts}{$word};
         $usages{$word} = $self->{stats}->{wordcounts}{$word};
     }
     }
@@ -1521,7 +1521,7 @@ sub _mostusedword
             # Skip nicks.  It's far more efficient to do this here than when
             # Skip nicks.  It's far more efficient to do this here than when
             # @popular is created.
             # @popular is created.
             next if is_ignored($popular[$i]);
             next if is_ignored($popular[$i]);
-            next if exists $self->{stats}->{lines}{find_alias($popular[$i])};
+            next if is_nick($popular[$i]);
             my $a = $count + 1;
             my $a = $count + 1;
             my $popular = htmlentities($popular[$i]);
             my $popular = htmlentities($popular[$i]);
             my $wordcount = $self->{stats}->{wordcounts}{$popular[$i]};
             my $wordcount = $self->{stats}->{wordcounts}{$popular[$i]};

+ 13 - 11
modules/Pisg/Parser/Logfile.pm

@@ -462,10 +462,10 @@ sub _parse_words
         next if ($ignoreword->{$word});
         next if ($ignoreword->{$word});
 
 
         # ignore contractions
         # ignore contractions
-        next if ($word =~ m/'..?$/);
+        next if ($word =~ m/'.{1,2}$/);
 
 
         # Also ignore stuff from URLs.
         # Also ignore stuff from URLs.
-        next if ($word =~ m/https?|^\/\//);
+        next if ($word =~ m/^https?$|^\/\//);
 
 
         $stats->{wordcounts}{$word}++;
         $stats->{wordcounts}{$word}++;
         $stats->{wordnicks}{$word} = $nick;
         $stats->{wordnicks}{$word} = $nick;
@@ -488,15 +488,17 @@ sub _uniquify_nicks {
     my ($stats) = @_;
     my ($stats) = @_;
 
 
     foreach my $word (keys %{ $stats->{wordcounts} }) {
     foreach my $word (keys %{ $stats->{wordcounts} }) {
-	my $realnick = find_alias($word);
-
-	# The lc() is an attempt at being case insensitive.
-	if (lc($realnick) ne lc($word)) {
-	    $stats->{wordcounts}{$realnick} += $stats->{wordcounts}{$word};
-	    $stats->{wordnicks}{$realnick}   = $stats->{wordnicks}{$word};
-	    delete $stats->{wordcounts}{$word};
-	    delete $stats->{wordnicks}{$word};
-	}
+        if (is_nick($word)) {
+	    my $realnick = find_alias($word);
+
+	    # The lc() is an attempt at being case insensitive.
+	    if (lc($realnick) ne lc($word)) {
+	        $stats->{wordcounts}{$realnick} += $stats->{wordcounts}{$word};
+	        $stats->{wordnicks}{$realnick}   = $stats->{wordnicks}{$word};
+	        delete $stats->{wordcounts}{$word};
+	        delete $stats->{wordnicks}{$word};
+	    }
+        }
     }
     }
 }
 }