<commit_before>//
//  ViewController.swift
//  WatchCuts
//
//  Created by <NAME> on 3/19/16.
//  Copyright © 2016 Baseball Hack Day 2016. All rights reserved.
//

import UIKit

class ViewController: UIViewController, UITextFieldDelegate {
    

    @IBOutlet weak var batLengthQuestionLabel: UILabel!
    @IBOutlet weak var batLengthField: UITextField!
    @IBOutlet weak var submitBatLengthButton: UIButton!
    
    @IBAction func submitBatLength(sender: UIButton) {
        batLengthField.resignFirstResponder()
    }
    let batLengthUserKey = "batLength"
    
    var accellerations: [Acceleration]?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        loadDataFromFile()
        
        batLengthField.delegate = self
        let defaults = NSUserDefaults.standardUserDefaults()
        if let batLength = defaults.stringForKey(batLengthUserKey) {
            batLengthField.text = batLength
        }
    }
    
    func textFieldShouldReturn(textField: UITextField) -> Bool {
        
        batLengthField.resignFirstResponder()
        return true
    }
    
    func textFieldDidEndEditing(batLengthField: UITextField) {
        let defaults = NSUserDefaults.standardUserDefaults()
        defaults.setObject(batLengthField.text, forKey: batLengthUserKey)
    }
    
    //MARK: Data loading
    
    func loadDataFromFile() {
        guard
            let file = NSBundle.mainBundle().pathForResource("data", ofType: "txt") else {
            assertionFailure("Couldn't find file!")
            return
        }
        
        guard let fromFile = try? String(contentsOfFile: file) else {
            assertionFailure("Couldn't load file")
            return
        }

        //Split string here
        
    }
    
}
<commit_msg>convert data to accelerations<commit_after>//
//  ViewController.swift
//  WatchCuts
//
//  Created by <NAME> on 3/19/16.
//  Copyright © 2016 Baseball Hack Day 2016. All rights reserved.
//

import UIKit

class ViewController: UIViewController, UITextFieldDelegate {
    

    @IBOutlet weak var batLengthQuestionLabel: UILabel!
    @IBOutlet weak var batLengthField: UITextField!
    @IBOutlet weak var submitBatLengthButton: UIButton!
    
    @IBAction func submitBatLength(sender: UIButton) {
        batLengthField.resignFirstResponder()
    }
    let batLengthUserKey = "batLength"
    
    var accellerations: [Acceleration]?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        loadDataFromFile()
        
        batLengthField.delegate = self
        let defaults = NSUserDefaults.standardUserDefaults()
        if let batLength = defaults.stringForKey(batLengthUserKey) {
            batLengthField.text = batLength
        }
    }
    
    func textFieldShouldReturn(textField: UITextField) -> Bool {
        
        batLengthField.resignFirstResponder()
        return true
    }
    
    func textFieldDidEndEditing(batLengthField: UITextField) {
        let defaults = NSUserDefaults.standardUserDefaults()
        defaults.setObject(batLengthField.text, forKey: batLengthUserKey)
    }
    
    //MARK: Data loading
    
    func loadDataFromFile() {
        guard
            let file = NSBundle.mainBundle().pathForResource("data", ofType: "txt") else {
            assertionFailure("Couldn't find file!")
            return
        }
        
        guard let fromFile = try? String(contentsOfFile: file) else {
            assertionFailure("Couldn't load file")
            return
        }

        //Split string here
        
        let linePoints = fromFile.componentsSeparatedByCharactersInSet(NSCharacterSet.newlineCharacterSet())
        let stringPointsArray = linePoints.map{
            return $0.stringByTrimmingCharactersInSet(.whitespaceCharacterSet()).stringByTrimmingCharactersInSet(.punctuationCharacterSet())
        }
        let pointsArray = stringPointsArray.map{
            return Acceleration.fromDescription($0)
        }
        accellerations = pointsArray
    }
    
}

{'fraction_non_alphanumeric': 0.08046836073741903, 'fraction_numerical': 0.006975585450921774, 'mean_word_length': 2.4141156462585034, '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': '4810206', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1096, 'n_words': 242}