<commit_before>require File.dirname(__FILE__) + '/config'

module EasyOpen
  class CallStackRepository
    class << self
      def init
        open("#{Config[:call_stack_file]}", "w") { |mio|
          Marshal.dump([], mio)
        }
      end
      
      def save(call_stack)
        open("#{Config[:call_stack_file]}", "w") { |mio|
          Marshal.dump(call_stack, mio)
        }
      end
      
      def load
        begin
          open("#{Config[:call_stack_file]}", "r") { |io|
            Marshal.load(io)        
          }          
        rescue
          puts "not found call_stack file. please create_def_index_file(F13)"
          exit
        end
      end
    end
  end
  
  class DefDataRepository
    class << self
      def save(def_index)
        open("#{Config[:def_index_file]}", "w") { |mio|
          Marshal.dump(def_index, mio)
        }
      end
      
      def load
        begin
          def_index = nil
          open("#{Config[:def_index_file]}", "r") { |io|
            def_index = Marshal.load(io)
          }
          return def_index
        rescue
          puts "not found def_index file. please create_def_index_file(F13) before open_def"
          exit
        end      
      end
    end
  end
end<commit_msg>change message<commit_after>require File.dirname(__FILE__) + '/config'

module EasyOpen
  class CallStackRepository
    class << self
      def init
        open("#{Config[:call_stack_file]}", "w") { |mio|
          Marshal.dump([], mio)
        }
      end
      
      def save(call_stack)
        open("#{Config[:call_stack_file]}", "w") { |mio|
          Marshal.dump(call_stack, mio)
        }
      end
      
      def load
        begin
          open("#{Config[:call_stack_file]}", "r") { |io|
            Marshal.load(io)        
          }          
        rescue
          puts "not found call_stack file. please create_def_index_file(command F12)"
          exit
        end
      end
    end
  end
  
  class DefDataRepository
    class << self
      def save(def_index)
        open("#{Config[:def_index_file]}", "w") { |mio|
          Marshal.dump(def_index, mio)
        }
      end
      
      def load
        begin
          def_index = nil
          open("#{Config[:def_index_file]}", "r") { |io|
            def_index = Marshal.load(io)
          }
          return def_index
        rescue
          puts "not found def_index file. please create_def_index_file(command F12) before open_def"
          exit
        end      
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10642491131257391, 'fraction_numerical': 0.0031533307055577452, 'mean_word_length': 1.5740365111561867, 'pattern_counts': {'":': 0, '<': 11, '<?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': '3203130', 'n_tokens_mistral': 774, 'n_tokens_neox': 777, 'n_words': 172}