<commit_before>module Lurch
  module Handlers
    class Weather < Handler

      rule /weather (?:in|at) (\w*)/ do
        message 'The weather is nice today'
        succeed
      end

    end
  end
end<commit_msg>Working Weather handler<commit_after>require 'net/http'
require 'json'

module Lurch
  module Handlers
    class Weather < Handler

      rule /weather (?:doing |like )?(?:in|at) (\w*)/ do
        location_name = matches[1]

        uri = URI("http://api.openweathermap.org/data/2.5/weather?q=#{location_name}&units=metric")
        response = JSON.parse(Net::HTTP.get(uri))

        description = response['weather'][0]['description'].capitalize
        temperature = response['main']['temp']

        message "#{description} and #{temperature} degrees"
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.13157894736842105, 'fraction_numerical': 0.005012531328320802, 'mean_word_length': 2.878640776699029, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6586754', 'n_tokens_mistral': 253, 'n_tokens_neox': 232, 'n_words': 61}