mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-30 07:59:42 +01:00
Factoids: Selectors now fix leading indefinite articles; i.e. a %(orange) -> an orange
This commit is contained in:
parent
51f2c1ffd9
commit
af7573a20a
@ -687,7 +687,16 @@ sub expand_factoid_selectors {
|
|||||||
|
|
||||||
last if not length $extracted;
|
last if not length $extracted;
|
||||||
|
|
||||||
$result .= $self->select_item($context, $extracted, \$rest, %opts);
|
my $item = $self->select_item($context, $extracted, \$rest, %opts);
|
||||||
|
|
||||||
|
if ($result =~ s/\b(a|an)(\s+)$//i) {
|
||||||
|
my ($article, $trailing) = ($1, $2);
|
||||||
|
my $fixed_article = select_indefinite_article $item;
|
||||||
|
$fixed_article = ucfirst $fixed_article if $article =~ m/^A/;
|
||||||
|
$item = $fixed_article . $trailing . $item;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result .= $item;
|
||||||
$action = $rest;
|
$action = $rest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user