<commit_before>package DDG::Spice::UV;
# ABSTRACT: Use the web service provided by EPA to display the UV Index for locations in the US.
# The web service is described here: http://www.epa.gov/enviro/facts/services.html#uvindex

use strict;
use DDG::Spice;

spice is_cached => 1;

# Triggers
triggers startend => 'uv', 'uv index', 'current uv index';

spice from => '([^/]*)/?([^/]*)';

#hourly data - for the next version...
#spice to => 'http://iaspub.epa.gov/enviro/efservice/getEnvirofactsUVHOURLY/CITY/$1/STATE/$2/JSON';

#daily data - just one value for the day...
spice to => 'http://iaspub.epa.gov/enviro/efservice/getEnvirofactsUVDAILY/CITY/$1/STATE/$2/JSON';

#UV Index might change daily, but not in the middle of the night.
spice proxy_cache_valid => "200 304 4h";

spice wrap_jsonp_callback => 1;

# Handle statement
handle remainder => sub {

    #remove question marks, "what is" questions
    s/\?|what|is|the|\s|current//gi;

    return if $_;
<commit_msg>Switch API URL to HTTPS because it now redirects there<commit_after>package DDG::Spice::UV;

# ABSTRACT: Use the web service provided by EPA to display the UV Index for locations in the US.
# The web service is described here: http://www.epa.gov/enviro/facts/services.html#uvindex

use strict;
use DDG::Spice;

spice is_cached => 1;

triggers startend => 'uv', 'uv index', 'current uv index';

spice from => '([^/]*)/?([^/]*)';

#hourly data - for the next version...
#spice to => 'https://iaspub.epa.gov/enviro/efservice/getEnvirofactsUVHOURLY/CITY/$1/STATE/$2/JSON';

#daily data - just one value for the day...
spice to => 'https://iaspub.epa.gov/enviro/efservice/getEnvirofactsUVDAILY/CITY/$1/STATE/$2/JSON';

#UV Index might change daily, but not in the middle of the night.
spice proxy_cache_valid => "200 304 4h";

spice wrap_jsonp_callback => 1;

# Handle statement
handle remainder => sub {

    #remove question marks, "what is" questions
    s/\?|what|is|the|\s|current//gi;

    return if $_;

{'fraction_non_alphanumeric': 0.14820435002529084, 'fraction_numerical': 0.013151239251390997, 'mean_word_length': 4.084832904884319, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '7418590', 'n_tokens_mistral': 725, 'n_tokens_neox': 699, 'n_words': 208}