<commit_before>require 'fileutils'
require 'find'
require 'pathname'

module FSSM
  class Pathname < ::Pathname
    ROOT = '/'.freeze
    VIRTUAL_REGEX = /^file:([^!]*)!/

    class << self
      def for(path)
        path.is_a?(Pathname) ? path : new(path)
      end

      alias :[] :glob
    end
    
    def is_virtual?
      !!(VIRTUAL_REGEX =~ to_s)
    end

    def segments
      path = to_s
      array = path.split(File::SEPARATOR)
      array.delete('')
      array.insert(0, ROOT) if path[0,1] == ROOT
      array<commit_msg>fix this code for windows usage<commit_after>require 'fileutils'
require 'find'
require 'pathname'

module FSSM
  class Pathname < ::Pathname
    VIRTUAL_REGEX = /^file:([^!]*)!/

    class << self
      def for(path)
        path.is_a?(::FSSM::Pathname) ? path : new(path)
      end

      alias :[] :glob
    end
    
    def is_virtual?
      !!(VIRTUAL_REGEX =~ to_s)
    end

    def segments
      path = to_s
      array = path.split(File::SEPARATOR)
      array.delete('')
      array.insert(0, File::SEPARATOR) if path[0,1] == File::SEPARATOR
      array[0] += File::SEPARATOR if path[0,3] =~ SEPARATOR_PAT
      array
{'fraction_non_alphanumeric': 0.13917525773195877, 'fraction_numerical': 0.007731958762886598, 'mean_word_length': 2.4672619047619047, 'pattern_counts': {'":': 0, '<': 9, '<?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': '3058123', 'n_tokens_mistral': 435, 'n_tokens_neox': 420, 'n_words': 95}