From 52995cedece920c5e4a85b7b9c4561fd05af7de8 Mon Sep 17 00:00:00 2001 From: dms Date: Mon, 5 Feb 2001 15:43:34 +0000 Subject: [PATCH] - remove front/rear whitespaces - 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 | 1 + src/Factoids/Question.pl | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Factoids/Norm.pl b/src/Factoids/Norm.pl index 92b1513..4ce2ba0 100644 --- a/src/Factoids/Norm.pl +++ b/src/Factoids/Norm.pl @@ -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; } diff --git a/src/Factoids/Question.pl b/src/Factoids/Question.pl index 1001c0b..03962f1 100644 --- a/src/Factoids/Question.pl +++ b/src/Factoids/Question.pl @@ -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 '$query'."); + &DEBUG("Question: '$query[0]' did not exist; '$query[$i]' ($i) did"); } return $result; -- 2.39.2