<commit_before>package DDG::Spice::WGHA;
# ABSTRACT: Search for events on was geht heute ab.de.

use strict;
use DDG::Spice;
use utf8;

primary_example_queries "was geht in frankfurt";
secondary_example_queries "wasgeht in berlin";
description "Events in Germany";
name "WGHA Events";
code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/WGHA.pm";
topics "entertainment", "special_interest";
category  "entertainment";
attribution web =>   ['http://www.wasgehtheuteab.de','<NAME>'],
            email => ['http://www.wasgehtheuteab.de','<NAME>'];

my @triggers = ("was geht", "wasgeht", "aus gehen", "ausgehen", "nachtleben", "party", "parties", "partys", "feiern", "abfeiern", "weg gehen","weggehen", "tanz", "tanzen", "veranstaltung", "veranstaltungen", "fest" );

triggers any => @triggers;

spice to => 'http://ddg.wasgehtheuteab.de/duckduckgo/events.json?q=$1&callback={{callback}}&api_key={{ENV{DDG_SPICE_WGHA_APIKEY}}}';
spice proxy_cache_valid => "200 5m";

handle query_lc => sub {
  return $_ if $loc->country_code eq 'DE';

  if ($_ =~ /aschaffenburg|augsburg|berlin|bremen|darmstadt|dortmund|dresden|düsseldorf|duesseldorf|essen|frankfurt|ffm|freiburg|hamburg|hannover|heidelberg|kassel|köln|koeln|leipzig|mainz|mannheim|münchen|muenchen|münster|muenster|nürnberg|nuernberg|stuttgart|wiesbaden/) {
    return $_;
  }
  return;
};

1;<commit_msg>Only trigger spice when a usefull city is in the query<commit_after>package DDG::Spice::WGHA;
# ABSTRACT: Search for events on was geht heute ab.de.

use strict;
use DDG::Spice;
use utf8;

primary_example_queries "was geht in frankfurt";
secondary_example_queries "wasgeht in berlin";
description "Events in Germany";
name "WGHA Events";
code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/WGHA.pm";
topics "entertainment", "special_interest";
category  "entertainment";
attribution web =>   ['http://www.wasgehtheuteab.de','<NAME>'],
            email => ['http://www.wasgehtheuteab.de','<NAME>'];

my @triggers = ("was geht", "wasgeht", "aus gehen", "ausgehen", "nachtleben", "party", "parties", "partys", "feiern", "abfeiern", "weg gehen","weggehen", "tanz", "tanzen", "veranstaltung", "veranstaltungen", "fest" );

triggers any => @triggers;

spice to => 'http://ddg.wasgehtheuteab.de/duckduckgo/events.json?q=$1&callback={{callback}}&api_key={{ENV{DDG_SPICE_WGHA_APIKEY}}}';
spice proxy_cache_valid => "200 5m";

handle query_lc => sub {
  $a = $_ . ' ' . $loc->city;
  if ($a =~ /aschaffenburg|augsburg|berlin|berlin-biesdorf|berlin-friedrichshain|berlin-karow|berlin-köpenick|berlin-lichtenberg|berlin-marzahn|berlin-mitte|berlin-oberschöneweide|berlin-pankow|berlin-treptow|bremen|cologne|darmstadt|dieburg|dortmund|dreieich|dresden|dresden-altstadt|dresden-neustadt|düsseldorf|essen|ffm|frankfurt|frankfurt am main|freiburg|freiburg im breisgau|friedrichshain|griesheim|halle|hamburg|hamburg-eimsbüttel|hamburg-mitte|hannover|hanover|heidelberg|kassel|koeln|germany|kreuzberg|köln|leipzig|leipzig-connewitz|leipzig-leutzsch|leipzig-plagwitz|leipzig-stötteritz|mainz|mannheim|munich|mühlheim|münchen|münchen|germany|münster|neu isenburg|nuremberg|nürnberg|offenbach|prenzlauer berg|sankt pauli|sersheim|stuttgart|wiesbaden/) {
    return $a;
  }
  return;
};

1;
{'fraction_non_alphanumeric': 0.16120218579234974, 'fraction_numerical': 0.004250151791135397, 'mean_word_length': 7.558441558441558, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4187869', 'n_tokens_mistral': 1353, 'n_tokens_neox': 1339, 'n_words': 193}