<commit_before>package DDG::Spice::SunRiseSet;
# ABSTRACT: Returns package information from npm package manager's registry.

use DDG::Spice;
use YAML::XS qw( Load );

primary_example_queries "sunset Oslo", "sunrise Oslo";
secondary_example_queries "Oslp sunset time", "Oslo sunrise time";
description "Provides the sunrise/sunset time of country, city or state searched";
name "SunRiseSet";
code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/SunRiseSet.pm";
icon_url "/i/timeanddate.com.ico";
topics "everyday";
category "geography";
attribution github  => ['https://github.com/iambibhas', 'Bibhas'];

spice to => 'http://api.xmltime.com/timeservice?accesskey={{ENV{DDG_SPICE_TIME_AND_DATE_ACCESSKEY}}}&secretkey={{ENV{DDG_SPICE_TIME_AND_DATE_SECRETKEY}}}&out=js&query=$1&time=1&tz=1&verbosetime=1&sun=1';
spice wrap_jsonp_callback => 1;
spice proxy_cache_valid => "12h";

triggers any => "sunset", "sunrise", "sunset in", "sunrise in";
my $capitals = Load(scalar share("capitals.yml")->slurp);

handle remainder => sub {
    my $q = lc $_;

    $q =~ s/,/ /g;
    $q =~ s/(^\s+|\s+$)//g;
    $q =~ s/\s+/ /g;

    if (my $caps = $capitals->{$q}) {
        # These are internally sorted by population, so assume they want the big one for now.
        $q = string_for_search($caps->[0]);
        return $q;<commit_msg>spice/sun_rise_set - added twitter attribution<commit_after>package DDG::Spice::SunRiseSet;
# ABSTRACT: Returns package information from npm package manager's registry.

use DDG::Spice;
use YAML::XS qw( Load );

primary_example_queries "sunset Oslo", "sunrise Oslo";
secondary_example_queries "Oslp sunset time", "Oslo sunrise time";
description "Provides the sunrise/sunset time of country, city or state searched";
name "SunRiseSet";
code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/SunRiseSet.pm";
icon_url "/i/timeanddate.com.ico";
topics "everyday";
category "geography";
attribution github  => ['https://github.com/iambibhas', 'Bibhas'],
            twitter => ['https://twitter.com/bibhasdn', '<NAME>'];

spice to => 'http://api.xmltime.com/timeservice?accesskey={{ENV{DDG_SPICE_TIME_AND_DATE_ACCESSKEY}}}&secretkey={{ENV{DDG_SPICE_TIME_AND_DATE_SECRETKEY}}}&out=js&query=$1&time=1&tz=1&verbosetime=1&sun=1';
spice wrap_jsonp_callback => 1;
spice proxy_cache_valid => "12h";

triggers any => "sunset", "sunrise", "sunset in", "sunrise in";
my $capitals = Load(scalar share("capitals.yml")->slurp);

handle remainder => sub {
    my $q = lc $_;

    $q =~ s/,/ /g;
    $q =~ s/(^\s+|\s+$)//g;
    $q =~ s/\s+/ /g;

    if (my $caps = $capitals->{$q}) {
        # These are internally sorted by population, so assume they want the big one for now.
        $q = string_for_search($caps->[0]);
        return $q;
{'fraction_non_alphanumeric': 0.16726105563480742, 'fraction_numerical': 0.006419400855920114, 'mean_word_length': 4.831600831600832, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 23, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '2855605', 'n_tokens_mistral': 1061, 'n_tokens_neox': 1022, 'n_words': 229}