<commit_before>module BotLib
  mattr_accessor :commands

  class Command < Struct.new(:file_name, :namespace, :action, :description, :options)
    def initialize(*properties)<commit_msg>helper for loading commands from json<commit_after>module BotLib
  mattr_accessor :commands

  class Command < Struct.new(:file_name, :namespace, :action, :description, :options)
    def self.commands_from_json_file(commands_file_path)
      commands = JSON.parse(IO.read(commands_file_path))
      commands.keys.map {|file|
        command_config = commands[file]
        args = [file] + [
          command_config['namespace'], command_config['action'],
          command_config['description'], command_config['options']
        ]
        new(*args)
      }
    end

    def initialize(*properties)
{'fraction_non_alphanumeric': 0.11068702290076336, 'fraction_numerical': 0.0, 'mean_word_length': 3.949685534591195, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4295611', 'n_tokens_mistral': 223, 'n_tokens_neox': 218, 'n_words': 46}