<commit_before># coding: utf-8

require "cgi"
require "time"
require "uri"

module Tweetwine
  module Util
    extend self

    def blank?(str)
      str.nil? || str.empty?
    end

    def humanize_time_diff(from, to)
      from = Time.parse(from.to_s) unless from.is_a? Time
      to = Time.parse(to.to_s) unless to.is_a? Time

      difference = (to - from).to_i.abs

      value, unit = case difference
        when 0..59 then [difference, "sec"]
        when 60..3599 then [(difference/60.0).round, "min"]
        when 3600..86399 then [(difference/3600.0).round, "hour"]
        else [(difference/86400.0).round, "day"]
      end

      [value, pluralize_unit(value, unit)]
    end<commit_msg>Code formatting<commit_after># coding: utf-8

require "cgi"
require "time"
require "uri"

module Tweetwine
  module Util
    extend self

    def blank?(str)
      str.nil? || str.empty?
    end

    def humanize_time_diff(from, to)
      from = Time.parse(from.to_s) unless from.is_a? Time
      to = Time.parse(to.to_s) unless to.is_a? Time

      difference = (to - from).to_i.abs

      value, unit = case difference
      when 0..59 then [difference, "sec"]
      when 60..3599 then [(difference/60.0).round, "min"]
      when 3600..86399 then [(difference/3600.0).round, "hour"]
      else [(difference/86400.0).round, "day"]
      end

      [value, pluralize_unit(value, unit)]
    end
{'fraction_non_alphanumeric': 0.1336206896551724, 'fraction_numerical': 0.04741379310344827, 'mean_word_length': 2.571794871794872, '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': '3788430', 'n_tokens_mistral': 539, 'n_tokens_neox': 475, 'n_words': 126}