<commit_before>module PoParser
  # Feed each block of PO file to Parser.
  class Tokenizer
    def initialize
      @po = Po.new
    end

    def extract_entries(path)
      @po.path = path
      File.open(path, 'r').each_line("\n\n") do |block|
        block.strip!
        @po << parse_block(block) if block != ''
      end
      @po
    end

  private
    def parse_block(block)
      hash = SimplePoParser.parse_message(block)
    end
  end
end<commit_msg>force the tokenizer to load files in utf-8 (#20)<commit_after>module PoParser
  # Feed each block of PO file to Parser.
  class Tokenizer
    def initialize
      @po = Po.new
    end

    def extract_entries(path)
      @po.path = path
      File.open(path, 'r:utf-8').each_line("\n\n") do |block|
        block.strip!
        @po << parse_block(block) if block != ''
      end
      @po
    end

  private
    def parse_block(block)
      hash = SimplePoParser.parse_message(block)
    end
  end
end
{'fraction_non_alphanumeric': 0.10197710718002082, 'fraction_numerical': 0.004162330905306972, 'mean_word_length': 2.2610169491525425, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7428594', 'n_tokens_mistral': 324, 'n_tokens_neox': 314, 'n_words': 89}