<commit_before>//
//  String.swift
//  SwiftLevelDB
//
//  Created by <NAME> on 8/22/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//
//  See LICENCE for details.
//

import Foundation

public extension String {
    var length: Int {
        return characters.count
    }
    
    public var cString: UnsafeMutablePointer<Int8> {
        return UnsafeMutablePointer<Int8>(mutating: NSString(string: self).utf8String)!
    }
    
    public static func fromCString(_ cString: UnsafeRawPointer, length: Int) -> String {
        #if os(Linux) 
            if let result =  NSString(bytes: cString, length: length, encoding: String.Encoding.utf8.rawValue)?._bridgeToSwift() {
                return result
            } else {
                return ""
            }
        #else
            return NSString(bytes: cString, length: length, encoding: String.Encoding.utf8.rawValue)! as String;
        #endif
   }
}

func DLog(message: String, filename: String = #file, function: String = #function, line: Int = #line) {
    #if DEBUG
        NSLog("[\(NSString(string: filename).lastPathComponent):\(line)] \(function) - \(message)")
    #endif
}

func ALog(message: String, filename: String = #file, function: String = #function, line: Int = #line) {
    NSLog("%@","[\(NSString(string: filename).lastPathComponent):\(line)] \(function) - \(message)")
}<commit_msg>NSLog("[\(NSString(string: filename).lastPathComponent):\(line)] \(function) - \(message)")<commit_after>//
//  String.swift
//  SwiftLevelDB
//
//  Created by <NAME> on 8/22/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//
//  See LICENCE for details.
//

import Foundation

public extension String {
    var length: Int {
        return characters.count
    }
    
    public var cString: UnsafeMutablePointer<Int8> {
        return UnsafeMutablePointer<Int8>(mutating: NSString(string: self).utf8String)!
    }
    
    public static func fromCString(_ cString: UnsafeRawPointer, length: Int) -> String {
        #if os(Linux) 
            if let result =  NSString(bytes: cString, length: length, encoding: String.Encoding.utf8.rawValue)?._bridgeToSwift() {
                return result
            } else {
                return ""
            }
        #else
            return NSString(bytes: cString, length: length, encoding: String.Encoding.utf8.rawValue)! as String;
        #endif
   }
}

func DLog(message: String, filename: String = #file, function: String = #function, line: Int = #line) {
    #if DEBUG
        NSLog("[\(NSString(string: filename).lastPathComponent):\(line)] \(function) - \(message)")
    #endif
}

func ALog(message: String, filename: String = #file, function: String = #function, line: Int = #line) {
    NSLog("[\(NSString(string: filename).lastPathComponent):\(line)] \(function) - \(message)")
}
{'fraction_non_alphanumeric': 0.14174067495559503, 'fraction_numerical': 0.00994671403197158, 'mean_word_length': 2.7298013245033115, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '2806875', 'n_tokens_mistral': 874, 'n_tokens_neox': 820, 'n_words': 217}