<commit_before>//
//  main.swift
//  ParseCSV
//
//  Created by <NAME> on 27.06.21.
//

import Foundation

func process(string: String) throws {
    print("your code here")
}

func processFile(at url: URL) throws {
    let s = try String(contentsOf: url)
    try process(string: s)
}

func main() {
    guard CommandLine.arguments.count > 1 else {
        print("usage: \(CommandLine.arguments[0]) file...")
        return
    }
    for path in CommandLine.arguments[1...] {
        do {
            let u = URL(fileURLWithPath: path)
            try processFile(at: u)
        } catch {
            print("error processing: \(path): \(error)")
        }
    }
}<commit_msg>Split lines by a pipe symbol<commit_after>//
//  main.swift
//  ParseCSV
//
//  Created by <NAME> on 27.06.21.
//

import Foundation

func process(string: String) throws {
    let lines = string.split(separator: "\n")
    for line in lines {
        let columns = line.split(separator: "|", omittingEmptySubsequences: true)
        for column in columns {
            print("column: \(column)")
        }
    }
}

func processFile(at url: URL) throws {
    let s = try String(contentsOf: url)
    try process(string: s)
}

func main() {
    guard CommandLine.arguments.count > 1 else {
        print("usage: \(CommandLine.arguments[0]) file...")
        return
    }
    for path in CommandLine.arguments[1...] {
        do {
            let u = URL(fileURLWithPath: path)
            try processFile(at: u)
        } catch {
            print("error processing: \(path): \(error)")
        }
    }
}
{'fraction_non_alphanumeric': 0.13850063532401524, 'fraction_numerical': 0.011435832274459974, 'mean_word_length': 2.0701754385964914, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4525470', 'n_tokens_mistral': 505, 'n_tokens_neox': 486, 'n_words': 135}