<commit_before># encoding: utf-8

require 'forecast_io'
require 'geocoder'

class Weather < Dumbstore::App
  text_id 'weather'

  def text params
  	fragments = [""]
  	MAX_SIZE = 160
	message_body = params['Body']

	lat = Geocoder.search("#{message_body}").first.geometry["location"]["lat"]
	lng = Geocoder.search("#{message_body}").first.geometry["location"]["lng"]

	Forecast::IO.api_key = '<KEY>'

	forecast = Forecast::IO.forecast(lat, lng)

	forecast_current = "It is currently #{forecast.currently.temperature} degrees and #{forecast.hourly.summary}"
	forecast_future = forecast.daily.summary.gsub(/°/," degrees")
	forecast_string = forecast_current + forecast_future 

	forecast_string.split.each do |word|
		if fragments.last.length + word.length + 1 > MAX_SIZE
			fragments.push word 
		else
			fragments.last << " #{word}"
		end
	end
	
    "<Response>#{fragments.map { |frags| "<Sms> #{frags} </Sms>" }.join}</Response>"
      
  end
end
<commit_msg>Fix syntax error in weather.rb<commit_after># encoding: utf-8

require 'forecast_io'
require 'geocoder'

class Weather < Dumbstore::App
  text_id 'weather'

  def text params
  	fragments = [""]
  	max_size = 160
	message_body = params['Body']

	lat = Geocoder.search("#{message_body}").first.geometry["location"]["lat"]
	lng = Geocoder.search("#{message_body}").first.geometry["location"]["lng"]

	Forecast::IO.api_key = '<KEY>'

	forecast = Forecast::IO.forecast(lat, lng)

	forecast_current = "It is currently #{forecast.currently.temperature} degrees and #{forecast.hourly.summary}"
	forecast_future = forecast.daily.summary.gsub(/°/," degrees")
	forecast_string = forecast_current + forecast_future 

	forecast_string.split.each do |word|
		if fragments.last.length + word.length + 1 > max_size
			fragments.push word 
		else
			fragments.last << " #{word}"
		end
	end
	
    "<Response>#{fragments.map { |frags| "<Sms>#{frags.strip}</Sms>" }.join}</Response>"
  end
end

{'fraction_non_alphanumeric': 0.15702479338842976, 'fraction_numerical': 0.005165289256198347, 'mean_word_length': 4.697058823529412, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 15, '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': '7610086', 'n_tokens_mistral': 710, 'n_tokens_neox': 670, 'n_words': 134}