From e4becb22a1dab83b4ce515750ca3576fb2e32237 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Thu, 14 Jul 2022 10:15:30 -0700 Subject: [PATCH] FuncBuiltins: maybe-the: special-case some indefinite nouns --- lib/PBot/Plugin/FuncBuiltins.pm | 7 ++++++- lib/PBot/VERSION.pm | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/PBot/Plugin/FuncBuiltins.pm b/lib/PBot/Plugin/FuncBuiltins.pm index 5e836b58..3a02c437 100644 --- a/lib/PBot/Plugin/FuncBuiltins.pm +++ b/lib/PBot/Plugin/FuncBuiltins.pm @@ -177,9 +177,14 @@ sub func_maybe_the { return $text; } + # special-case some indefinite nouns that Lingua::EN::Tagger treats as plain nouns + if ($word =~ m/(some|any|every|no)(thing|one|body|how|way|where|when|time|place)/i) { + return $text; + } + my $tagged = $self->{tagger}->add_tags($word); - if ($tagged !~ m/^\s*<(?:det|prps?|cd|in|nnp|to|rb|wdt|vbg|rbr|jjr)>/) { + if ($tagged !~ m/^\s*<(?:det|prps?|cd|in|nnp|to|rb|wdt|rbr|jjr)>/) { $text = "the $text"; } diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index bf1f228b..a43cd5e0 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,8 +25,8 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4559, - BUILD_DATE => "2022-07-10", + BUILD_REVISION => 4560, + BUILD_DATE => "2022-07-14", }; sub initialize {}