mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-19 10:29:30 +01:00
Levenshtein distance increased from 50% to 60%; Levenshtein searches all channels on unfound factoid
This commit is contained in:
parent
def3b6eae7
commit
c6e48954c5
@ -234,7 +234,7 @@ sub levenshtein_matches {
|
||||
my $distance = fastdistance($secondary_index_key, $index);
|
||||
my $length = (length($secondary_index_key) > length($index)) ? length $secondary_index_key : length $index;
|
||||
|
||||
if($distance / $length < 0.50) {
|
||||
if($distance / $length < 0.60) {
|
||||
$result .= $comma . $index;
|
||||
$comma = ", ";
|
||||
}
|
||||
|
@ -275,8 +275,7 @@ sub factadd {
|
||||
|
||||
if(defined $trigger) {
|
||||
$self->{pbot}->logger->log("$nick!$user\@$host attempt to overwrite $keyword\n");
|
||||
return undef;
|
||||
return "/msg $nick $keyword already exists.";
|
||||
return "/msg $nick $keyword already exists for " . ($from_chan eq '.*' ? 'global channel' : $from_chan) . ".";
|
||||
}
|
||||
|
||||
$self->{pbot}->factoids->add_factoid('text', $from_chan, $nick, $keyword, $text);
|
||||
|
@ -13,7 +13,6 @@ $VERSION = $PBot::PBot::VERSION;
|
||||
|
||||
use HTML::Entities;
|
||||
use Time::HiRes qw(gettimeofday);
|
||||
use Text::Levenshtein qw(fastdistance);
|
||||
use Carp ();
|
||||
|
||||
use PBot::FactoidModuleLauncher;
|
||||
@ -204,7 +203,7 @@ sub interpreter {
|
||||
($channel, $keyword) = $self->find_factoid($from, $keyword, $arguments);
|
||||
|
||||
if(not defined $keyword) {
|
||||
my $matches = $self->factoids->levenshtein_matches($from, lc $original_keyword);
|
||||
my $matches = $self->factoids->levenshtein_matches('.*', lc $original_keyword);
|
||||
|
||||
return undef if $matches eq 'none';
|
||||
|
||||
|
@ -13,8 +13,8 @@ use warnings;
|
||||
# These are set automatically by the build/commit script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 222,
|
||||
BUILD_DATE => "2010-06-29",
|
||||
BUILD_REVISION => 223,
|
||||
BUILD_DATE => "2010-06-30",
|
||||
};
|
||||
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user