AsciiTable: Improves triggering (#4124)

* AsciiTable: Triggering now for 'list of'

* AsciiTable: Add more triggers

* AsciiTable: Tests updated with new triggers
master
Manraj Singh 2017-04-25 01:05:38 +05:30 committed by Zaahir Moolla
parent aa882165fa
commit 67f6e084f2
3 changed files with 23 additions and 4 deletions

View File

@ -10,12 +10,19 @@ zci answer_type => 'ascii_table';
zci is_cached => 1;
triggers start => share('triggers.txt')->slurp;
my @triggers = share("triggers.txt")->slurp;
triggers startend => @triggers;
chomp(@triggers);
my $keywords = join("|", map(quotemeta, @triggers));
my $ascii = LoadFile(share('data.yml'));
handle remainder => sub {
return unless $_ eq '';
handle query_lc => sub {
s/^list of\b//;
return unless m/$keywords/;
return '',
structured_answer => {

View File

@ -19,4 +19,9 @@ ascii characters table
ascii chart
ascii codes chart
ascii characters chart
ascii reference chart
ascii reference chart
ascii character list
ascii characters list
ascii characters lookup
ascii character map
ascii character set table

View File

@ -13,6 +13,7 @@ zci is_cached => 1;
my $ascii = LoadFile('share/goodie/ascii_table/data.yml');
sub build_structured_answer {
my $result = {
title => 'ASCII Table',
table => $ascii
@ -81,6 +82,12 @@ ddg_goodie_test(
'ascii reference' => build_test(),
'ascii characters' => build_test(),
'character codes' => build_test(),
'ascii character map' => build_test(),
'list of ascii characters' => build_test(),
'list of ascii codes' => build_test(),
'list of char codes' => build_test(),
'list of vegetables' => undef,
'list of ascii' => undef,
'ascii convertor' => undef,
'ascii conversion' => undef,
'convert ascii' => undef,