<commit_before>require File.expand_path('../api', __FILE__)

module Google
  module Maps
    
    class Place
      attr_reader :text, :html, :keyword, :reference
      alias :to_s :text
      alias :to_html :html
      
      def initialize(data, keyword)
        @text = data.description
        @reference = data.reference
        @html = data.description.gsub(/(#{keyword})/i, '<strong>\1</strong>')
      end
      
      def self.find(keyword, language=:en)
        args = {:language => language, :input => keyword}
        args.merge!(key: Google::Maps.api_key) unless Google::Maps.api_key.nil?

        API.query(:places_service, args).predictions.map{|prediction| Place.new(prediction, keyword) }
      end

    end

    class PlaceDetails
      attr_reader :latitude, :longitude, :address, :reference
      alias :to_s :address

      def initialize(data)
        @latitude = data.geometry.location.lat.to_s
        @longitude = data.geometry.location.lng.to_s
        @reference = data.reference
        @address = data.formatted_address
      end

      def self.find(reference, language=:en)
        args = {:language => language, :input => reference}
        args.merge!(key: Google::Maps.api_key) unless Google::Maps.api_key.nil?

        PlaceDetails.new(API.query(:place_details_service, args).result)
      end

    end
    
  end
end<commit_msg>correct parameter name in PlaceDetails query<commit_after>require File.expand_path('../api', __FILE__)

module Google
  module Maps
    
    class Place
      attr_reader :text, :html, :keyword, :reference
      alias :to_s :text
      alias :to_html :html
      
      def initialize(data, keyword)
        @text = data.description
        @reference = data.reference
        @html = data.description.gsub(/(#{keyword})/i, '<strong>\1</strong>')
      end
      
      def self.find(keyword, language=:en)
        args = {:language => language, :input => keyword}
        args.merge!(key: Google::Maps.api_key) unless Google::Maps.api_key.nil?

        API.query(:places_service, args).predictions.map{|prediction| Place.new(prediction, keyword) }
      end

    end

    class PlaceDetails
      attr_reader :latitude, :longitude, :address, :reference
      alias :to_s :address

      def initialize(data)
        @latitude = data.geometry.location.lat.to_s
        @longitude = data.geometry.location.lng.to_s
        @reference = data.reference
        @address = data.formatted_address
      end

      def self.find(reference, language=:en)
        args = {:language => language, :reference => reference}
        args.merge!(key: Google::Maps.api_key) unless Google::Maps.api_key.nil?

        PlaceDetails.new(API.query(:place_details_service, args).result)
      end

    end
    
  end
end
{'fraction_non_alphanumeric': 0.11943539630836048, 'fraction_numerical': 0.0007238508867173362, 'mean_word_length': 2.6657824933687, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4642103', 'n_tokens_mistral': 847, 'n_tokens_neox': 824, 'n_words': 180}