<commit_before># commonjs fs module
# http://ringojs.org/api/v0.8/fs/

_ = require 'underscore'

jscocoa = require 'jscocoa'

module.exports =
  # Make the given path absolute by resolving it against the
  # current working directory.
  absolute: (path) ->
    if /~/.test path
      OSX.NSString.stringWithString(path).stringByExpandingTildeInPath
    else if path.indexOf('./') is 0
      throw "absolute: ./ not yet implemented"
    else
      path

  # Set the current working directory to `path`.
  changeWorkingDirectory: (path) ->
    OSX.NSFileManager.defaultManager.changeCurrentDirectoryPath path

  # Returns true if the file specified by path exists
  exists: (path) ->
   exists = OSX.NSFileManager.defaultManager.
      fileExistsAtPath_isDirectory path, null

  # Returns true if the file specified by path exists and is a
  # directory.
  isDirectory: (path) ->
    isDir = new jscocoa.outArgument
    exists = OSX.NSFileManager.defaultManager.
      fileExistsAtPath_isDirectory path, isDir
    exists and isDir.valueOf()

  # Returns true if the file specified by path exists and is a
  # regular file.
  isFile: (path) -><commit_msg>More methods from common.js fs.<commit_after># commonjs fs module
# http://ringojs.org/api/v0.8/fs/

_ = require 'underscore'

jscocoa = require 'jscocoa'

module.exports =
  # Make the given path absolute by resolving it against the
  # current working directory.
  absolute: (path) ->
    if /~/.test path
      OSX.NSString.stringWithString(path).stringByExpandingTildeInPath
    else if path.indexOf('./') is 0
      throw "absolute: ./ not yet implemented"
    else
      path

  # Return the basename of the given path. That is the path with
  # any leading directory components removed. If specified, also
  # remove a trailing extension.
  base: (path, ext) ->
    base = path.split("/").pop()
    if ext then base.replace(RegEx(ext + "$"), "") else base

  # Set the current working directory to `path`.
  changeWorkingDirectory: (path) ->
    OSX.NSFileManager.defaultManager.changeCurrentDirectoryPath path

  # Returns true if the file specified by path exists
  exists: (path) ->
   exists = OSX.NSFileManager.defaultManager.
      fileExistsAtPath_isDirectory path, null

  # Returns true if the file specified by path exists and is a
  # directory.
  isDirectory: (path) ->
    isDir = new jscocoa.outArgument
    exists = OSX.NSFileManager.defaultManager.
      fileExistsAtPath_isDirectory path, isDir
    exists and isDir.valueOf()

  # Returns true if the file specified by path exists and is a
  # regular file.
  isFile: (path) ->
{'fraction_non_alphanumeric': 0.09104878985785632, 'fraction_numerical': 0.002305032654629274, 'mean_word_length': 3.2899505766062602, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '6666550', 'n_tokens_mistral': 784, 'n_tokens_neox': 762, 'n_words': 261}