<commit_before>//
//  Task.swift
//  Zero
//
//  Created by <NAME> on 5/8/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation

struct Task: ModelType, Identifiable {

  var id: String = UUID().uuidString
  var title: String
  var memo: String?
  var isDone: Bool = false

  init(title: String, memo: String? = nil) {
    self.title = title
    self.memo = memo
  }

  init?(dictionary: [String: Any]) {
    guard let id = dictionary["id"] as? String,
      let title = dictionary["title"] as? String
      else { return nil }

    self.id = id
    self.title = title
    self.memo = dictionary["memo"] as? String
    self.isDone = dictionary["isDone"] as? Bool ?? false
  }

  func asDictionary() -> [String: Any] {
    var dictionary: [String: Any] = [
      "id": self.id,
      "title": self.title,
      "isDone": self.isDone
      ]

    if let memo = self.memo {
      dictionary["memo"] = memo
    }

    return dictionary
  }

}<commit_msg>feat(tally): add a value property of type Int<commit_after>//
//  Task.swift
//  Zero
//
//  Created by <NAME> on 5/8/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation

struct Task: ModelType, Identifiable {

  var id: String = UUID().uuidString
  var title: String
  var memo: String?
  var isDone: Bool = false
  var value: Int = 0

  init(title: String, memo: String? = nil) {
    self.title = title
    self.memo = memo
  }

  init?(dictionary: [String: Any]) {
    guard let id = dictionary["id"] as? String,
      let title = dictionary["title"] as? String
      else { return nil }

    self.id = id
    self.title = title
    self.memo = dictionary["memo"] as? String
    self.isDone = dictionary["isDone"] as? Bool ?? false
    self.value = dictionary["value"] as? Int ?? 0
  }

  func asDictionary() -> [String: Any] {
    var dictionary: [String: Any] = [
      "id": self.id,
      "title": self.title,
      "isDone": self.isDone,
      "value": self.value
      ]

    if let memo = self.memo {
      dictionary["memo"] = memo
    }

    return dictionary
  }

}
{'fraction_non_alphanumeric': 0.14223722275795564, 'fraction_numerical': 0.008678881388621022, 'mean_word_length': 2.446843853820598, 'pattern_counts': {'":': 7, '<': 7, '<?xml version=': 0, '>': 9, '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': '4600759', 'n_tokens_mistral': 714, 'n_tokens_neox': 678, 'n_words': 210}