<commit_before>module Zabbix

  # The +Zabbix::Reader+ object used to get values from the monitor file
  class Reader

    def initialize
      filename = 'tmp/zabbix-stats.yml'
      raise FileNotFoundError, 'Monitoring file not found' if !File.exists?(filename)
      @file = File.new(filename)
    end

    # Get a value from the Zabbix monitor file
    #
    # @param key [String] zabbix key
    #
    # @return [String] The monitoring value
    def get_value key
      @file.readlines.each do |line|
        match = line.scan(/^\s+#{key}: (.*)/)[0]
        return match unless match.nil?
      end
      nil
    end
  end
end<commit_msg>Revert "Try to speed up zabbix_reader a bit"<commit_after>require 'yaml'

module Zabbix

  # The +Zabbix::Reader+ object used to get values from the monitor file
  class Reader

    def initialize
      filename = 'tmp/zabbix-stats.yml'
      raise FileNotFoundError, 'Monitoring file not found' if !File.exists?(filename)
      @file = YAML.load_file(filename)
    end

    # Get a value from the Zabbix monitor file
    #
    # @param key [String] zabbix key
    #
    # @return [String] The monitoring value
    def get_value key
      @file['statistics'][key]
    end
  end
end
{'fraction_non_alphanumeric': 0.09239574816026165, 'fraction_numerical': 0.0008176614881439084, 'mean_word_length': 2.697885196374622, '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': '1508110', 'n_tokens_mistral': 393, 'n_tokens_neox': 384, 'n_words': 129}