]> git.donarmstrong.com Git - infobot.git/commitdiff
- remove front/rear whitespaces
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Mon, 5 Feb 2001 15:43:34 +0000 (15:43 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Mon, 5 Feb 2001 15:43:34 +0000 (15:43 +0000)
- trailing symbols should work now.

git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@343 c11ca15a-4712-0410-83d8-924469b57eb5

src/Factoids/Norm.pl
src/Factoids/Question.pl

index 92b1513b0f9a081dce09948f13c5472ba9e3fbbb..4ce2ba03c55167babbb10437023ed76097811200 100644 (file)
@@ -57,6 +57,7 @@ sub normquery {
 
        $in =~ s/\s+/ /g;
        $in =~ s/^\s*(.*?)\s*$/$1/;
+       $in =~ s/^\s+|\s+$//g;          # why twice, see Question.pl
 
        $in;
 }
index 1001c0b9ce8e32a99512becdfdb8fd1adc0652ba..03962f1ada3d260a64f5bb91d63e173defc41902 100644 (file)
@@ -35,7 +35,7 @@ sub doQuestion {
     if (!$addressed) {
        return '' unless ($finalQMark);
        return '' if (&IsParam("minVolunteerLength") == 0);
-       return '' if (length($query) < $param{'minVolunteerLength'});
+       return '' if (length $query < $param{'minVolunteerLength'});
     } else {
        ### TODO: this should be caught in Process.pl?
        return '' unless ($talkok);
@@ -52,6 +52,11 @@ sub doQuestion {
 
     push(@query, $query);      # 1: push original.
 
+    # valid factoid.
+    if ($query =~ s/[!.]$//) {
+       push(@query,$query);
+    }
+
     $x = &normquery($query);
     push(@query, $x) if ($x ne $query);
     $query = $x;
@@ -76,11 +81,6 @@ sub doQuestion {
        $questionWord = "where";
     }
 
-    # valid factoid.
-    if ($query =~ s/[\!\.]$//) {
-       push(@query,$query);
-    }
-
     for (my$i=0; $i<scalar(@query); $i++) {
        $query  = $query[$i];
        $result = &getReply($query);
@@ -93,7 +93,7 @@ sub doQuestion {
        }
 
        if ($i != 0) {
-           &DEBUG("Question: guessed factoid correctly ($i) => '$query'.");
+           &DEBUG("Question: '$query[0]' did not exist; '$query[$i]' ($i) did");
        }
 
        return $result;