<commit_before># encoding: utf-8

require 'concord'
require 'anima'
require 'morpher'
require 'adamantium'
require 'abstract_type'
require 'lupo'

module Ramom
  class Entity

    # An undefined value useful for default params
    Undefined = Class.new.freeze

    # An empty frozen array
    EMPTY_ARRAY = [].freeze

    # An empty frozen array
    EMPTY_HASH = {}.freeze

    def self.registry(environment)
      Registry.new(environment.definitions.each_with_object({}) {
        |(name, definition), hash|
        hash[name] = build(definition, environment)
      })
    end

    def self.definition_registry(options = EMPTY_HASH)
      Definition::Registry.new(options)
    end

    def self.build(definition, environment)
      name   = definition.entity_name
      model  = environment.model(name)
      mapper = Mapper.build(definition, environment)

      new(name, model, mapper)
    end<commit_msg>Nuke constants in favor of the toplevel Ramom ones<commit_after># encoding: utf-8

require 'concord'
require 'anima'
require 'morpher'
require 'adamantium'
require 'abstract_type'
require 'lupo'

module Ramom
  class Entity

    def self.registry(environment)
      Registry.new(environment.definitions.each_with_object({}) {
        |(name, definition), hash|
        hash[name] = build(definition, environment)
      })
    end

    def self.definition_registry(options = EMPTY_HASH)
      Definition::Registry.new(options)
    end

    def self.build(definition, environment)
      name   = definition.entity_name
      model  = environment.model(name)
      mapper = Mapper.build(definition, environment)

      new(name, model, mapper)
    end
{'fraction_non_alphanumeric': 0.09535304767652383, 'fraction_numerical': 0.0012070006035003018, 'mean_word_length': 3.328981723237598, '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': '7178256', 'n_tokens_mistral': 513, 'n_tokens_neox': 490, 'n_words': 124}