<commit_before>require 'yaml'

class GECOS
  class Archive
    
    INDEX_FILE = '.index'
    LOG_FILE   = '.log'
    
    def self.location
      config['archive'].sub(/^~/,ENV['HOME'])
    end
    
    def self.raw_directory
      config['raw_directory'].sub(/^~/,ENV['HOME'])
    end
    
    def self.index_file
      File.join(raw_directory, INDEX_FILE)
    end
    
    def self.repository
      config['repository']
    end
    
    def self.load_config(config_file="data/archive_config.yml")
      @config = YAML.load(File.read(config_file))
      @config['repository'] ||= ENV['GECOS_REPOSITORY']
      @config
    end
    
    def self.config
      @config ||= load_config
    end
    
    attr_reader :location
    
    def initialize(location=nil)
      @location = location || self.class.location
    end
    
    def index
      @archive_index ||= _index
    end

    def _index(index_file=nil)
      index_file ||= self.class.index_file
      File.read(File.join(location,index_file)).split("\n").map{|line| line.split(/\s+/)}
    end

    def file_name(name)
      name = File.basename(name)
      line = index.find{|l| l[0] == name}
      return nil unless line
      line[-1]
    end
    
    def config
      self.class.config
    end
    
    def log(message)
      
  end
end
<commit_msg>Fix bug in new Archive#log method<commit_after>require 'yaml'

class GECOS
  class Archive
    
    INDEX_FILE = '.index'
    LOG_FILE   = '.log'
    
    def self.location
      config['archive'].sub(/^~/,ENV['HOME'])
    end
    
    def self.raw_directory
      config['raw_directory'].sub(/^~/,ENV['HOME'])
    end
    
    def self.index_file
      File.join(raw_directory, INDEX_FILE)
    end
    
    def self.repository
      config['repository']
    end
    
    def self.load_config(config_file="data/archive_config.yml")
      @config = YAML.load(File.read(config_file))
      @config['repository'] ||= ENV['GECOS_REPOSITORY']
      @config
    end
    
    def self.config
      @config ||= load_config
    end
    
    attr_reader :location
    
    def initialize(location=nil)
      @location = location || self.class.location
    end
    
    def index
      @archive_index ||= _index
    end

    def _index(index_file=nil)
      index_file ||= self.class.index_file
      File.read(File.join(location,index_file)).split("\n").map{|line| line.split(/\s+/)}
    end

    def file_name(name)
      name = File.basename(name)
      line = index.find{|l| l[0] == name}
      return nil unless line
      line[-1]
    end
    
    def config
      self.class.config
    end
    
    def log(message)
      warn message
    end
  end
end

{'fraction_non_alphanumeric': 0.12151993980436418, 'fraction_numerical': 0.0015048908954100827, 'mean_word_length': 2.1730310262529833, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7109012', 'n_tokens_mistral': 900, 'n_tokens_neox': 878, 'n_words': 172}