<commit_before>require 'json'

#
# A module for define type, generate struct, and mapping.
#
module Response
    #
    # A module for type definition and validation.
    # Definitions are defined in JSON file.
    #
    module Type
        # Definition of models
        MODEL_DEFINITION = open('../config/types.json') { |io|
            JSON.load(io)
        }

        # Returns defined types list.
        def self.types
            MODEL_DEFINITION.keys
        end

        # Returns sorted fields for type.
        # If not defined type was given, empty list will be returned.
        def self.fields_for(type)
            MODEL_DEFINITION[type].to_a.sort
        end

        # Validates the type is defined or not.
        def self.defined?(type)
            self.types.include?(type)
        end
    end

    #
    # A module for generating Struct class for given fields.<commit_msg>[COSM] Split configuration path<commit_after>require 'json'

#
# A module for define type, generate struct, and mapping.
#
module Response
    #
    # A module for type definition and validation.
    # Definitions are defined in JSON file.
    #
    module Type
        # Definition JSON file
        DEFINITION_FILE = '../config/types.json'

        # Definition of models
        MODEL_DEFINITION = open(DEFINITION_FILE) { |io| JSON.load(io) }

        # Returns defined types list.
        def self.types
            MODEL_DEFINITION.keys
        end

        # Returns sorted fields for type.
        # If not defined type was given, empty list will be returned.
        def self.fields_for(type)
            MODEL_DEFINITION[type].to_a.sort
        end

        # Validates the type is defined or not.
        def self.defined?(type)
            self.types.include?(type)
        end
    end

    #
    # A module for generating Struct class for given fields.
{'fraction_non_alphanumeric': 0.07219827586206896, 'fraction_numerical': 0.0, 'mean_word_length': 1.9476190476190476, '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': '1528678', 'n_tokens_mistral': 518, 'n_tokens_neox': 497, 'n_words': 175}