Replaced 'regex' with 'end' trigger; Regex parsing moved to query

handle.
master
Ivo Hradek 2015-02-13 02:33:44 +01:00 committed by hradecek
parent e05cb43f97
commit cd52aeca20
1 changed files with 6 additions and 1 deletions

View File

@ -28,7 +28,7 @@ secondary_example_queries 'ahiru to hiragana',
zci is_cached => 1;
zci answer_type => 'kana';
triggers query_lc => qr/^(?<text>.*?)(?: to| in)?\s+(?<syll>hiragana|katakana|romaji)$/;
triggers end => qw/hiragana katakana romaji/;
my %dispatch = (
'hiragana' => \&to_hiragana,
@ -76,6 +76,11 @@ sub to_romaji {
};
handle query_lc => sub {
return unless /^
(?<text>.*?)
(?: to| in)?\s+
(?<syll>hiragana|katakana|romaji)
$/x;
my $text = $+{text};
my $syll = $+{syll};
my $answer = $dispatch{$syll}($text);