<commit_before>module Yogoshu
  module Locale

    def self.set_base_languages(*locales)
      locales.each do |locale|
        raise ArgumentError, "Base languages must be Symbols" unless locale.class == Symbol
      end
      @@base_languages = locales
    end

    def self.base_languages
      @@base_languages
    end

    def base_languages
      @@base_languages
    end

    def self.set_default_source_language(locale)
      @@default_source_language = locale unless !@@base_languages.include?(locale)
    end

    def self.default_source_language
      @@default_source_language
    end

    def default_source_language
      @@default_source_language
    end

    def respond_to?(method, priv=false)
      eval <<-END_RUBY
      case method
      when /(\\w+)_in_(#{base_languages.join("|")})$/
        respond_to?($1, priv)
      when /(\\w+)_in_(#{base_languages.join("|")})=$/
        respond_to?($1, priv)
      else
        super
      end
      END_RUBY
    end

    def method_missing(sym, *args)
      eval <<-END_RUBY
      case sym.to_s
      when /(\\w+)_in_(#{base_languages.join("|")})$/
        read_attribute $1, $2
      when /(\\w+)_in_(#{base_languages.join("|")})=$/
        write_attribute $1, args[0], $2 
      else
        super
      end
      END_RUBY
    end
  end
end
<commit_msg>Added _in_source_language method to locale module. I really need to write specs for this.<commit_after>module Yogoshu
  module Locale

    def self.set_base_languages(*locales)
      locales.each do |locale|
        raise ArgumentError, "Base languages must be Symbols" unless locale.class == Symbol
      end
      @@base_languages = locales
    end

    def self.base_languages
      @@base_languages
    end

    def base_languages
      @@base_languages
    end

    def self.set_default_source_language(locale)
      @@default_source_language = locale unless !@@base_languages.include?(locale)
    end

    def self.default_source_language
      @@default_source_language
    end

    def default_source_language
      @@default_source_language
    end

    def respond_to?(method, priv=false)
      eval <<-END_RUBY
      case method
      when /(\\w+)_in_(#{base_languages.join("|")})$/
        respond_to?($1, priv)
      when /(\\w+)_in_(#{base_languages.join("|")})=$/
        respond_to?($1, priv)
      when /(\\w+)_in_source_language$/
        respond_to?($1, priv)
      when /(\\w+)_in_source_language=$/
        respond_to?($1, priv)
      else
        super
      end
      END_RUBY
    end

    def method_missing(sym, *args)
      eval <<-END_RUBY
      case sym.to_s
      when /(\\w+)_in_(#{base_languages.join("|")})$/
        read_attribute $1, $2
      when /(\\w+)_in_(#{base_languages.join("|")})=$/
        write_attribute $1, args[0], $2 
      when /(\\w+)_in_source_language$/
        read_attribute $1, source_language unless source_language.nil?
      when /(\\w+)_in_source_language=$/
        write_attribute $1, args[0], source_language unless source_language.nil?
      else
        super
      end
      END_RUBY
    end
  end
end

{'fraction_non_alphanumeric': 0.11892417368762152, 'fraction_numerical': 0.006156837329876863, 'mean_word_length': 2.4646464646464645, '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': '7019333', 'n_tokens_mistral': 1049, 'n_tokens_neox': 1019, 'n_words': 218}