<commit_before>module Unitwise
  class Atom < Base
    attr_accessor :classification, :property, :metric, :special, :arbitrary
    attr_writer :dim

    include Unitwise::Composable

    class << self
      def data
        @data ||= data_files.reduce([]){|m,f| m += YAML::load File.open(f)}
      end

      def data_files
        %w(base_unit derived_unit).map{|type| Unitwise.data_file type}
      end
    end

    def base?
      scale.nil? && !@dim.nil?
    end

    def derived?
      !base?
    end

    def metric?
      base? ? true : !!metric
    end

    def nonmetric?
      !metric?
    end

    def special?
      !!special
    end

    def arbitrary?
      !!arbitrary
    end

    def depth
      base? ? 0 : scale.depth + 1
    end

    def terminal?
      depth <= 3
    end

    def dim
      terminal? ? @dim || property : composition_string
    end

    def scale=(attrs)
      @scale = if attrs[:function_code]
        Functional.new(attrs[:value], attrs[:unit_code], attrs[:function_code])
      else
        Scale.new(attrs[:value], attrs[:unit_code])
      end
    end

    def scalar
      base? ? 1 : scale.scalar
    end

    def functional(x=scalar, direction=1)
      scale.functional(x, direction)
    end

    def root_terms
      base? ? [Term.new(atom: self)] : scale.root_terms
    end

    def to_s
      "#{names.first} (#{primary_code})"
    end

    def inspect
      "<#{self.class} #{to_s}>"
    end

  end
end<commit_msg>Undo errant commit.<commit_after>module Unitwise
  class Atom < Base
    attr_accessor :classification, :property, :metric, :special, :arbitrary
    attr_writer :dim

    include Unitwise::Composable

    class << self
      def data
        @data ||= data_files.reduce([]){|m,f| m += YAML::load File.open(f)}
      end

      def data_files
        %w(base_unit derived_unit).map{|type| Unitwise.data_file type}
      end
    end

    def base?
      scale.nil? && !@dim.nil?
    end

    def derived?
      !base?
    end

    def metric?
      base? ? true : !!metric
    end

    def nonmetric?
      !metric?
    end

    def special?
      !!special
    end

    def arbitrary?
      !!arbitrary
    end

    def depth
      base? ? 0 : scale.depth + 1
    end

    def terminal?
      depth <= 3
    end

    def dim
      terminal? ? @dim || property : composition_string
    end

    def scale=(attrs)
      @scale = if attrs[:function_code]
        Functional.new(attrs[:value], attrs[:unit_code], attrs[:function_code])
      else
        Scale.new(attrs[:value], attrs[:unit_code])
      end
    end

    def scalar
      base? ? 1 : scale.scalar
    end

    def functional(x=scalar, direction=1)
      scale.functional(x, direction)
    end

    def root_terms
      base? ? [Term.new(atom: self)] : scale.root_terms
    end

    def to_s
      "#{primary_code} (#{names.join('|')})"
    end

    def inspect
      "<#{self.class} #{to_s}>"
    end

  end
end
{'fraction_non_alphanumeric': 0.11512261580381472, 'fraction_numerical': 0.0034059945504087193, 'mean_word_length': 2.0657620041753653, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 5, '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': '4852069', 'n_tokens_mistral': 1000, 'n_tokens_neox': 947, 'n_words': 247}