<commit_before>import Foundation

struct QueryBuilder {

  typealias Component = (String, String)

  let escapingCharacters = ":#[]@!$&'()*+,;="

  func buildQuery(parameters: [String: AnyObject]) -> String {
    var components: [Component] = []

    parameters.forEach { key, value in
      components += buildComponents(key: key, value: value)
    }

    return components.map({ "\($0)=\($1)" }).joinWithSeparator("&")
  }

  func buildComponents(key key: String, value: AnyObject) -> [Component] {
    var components: [Component] = []

    if let dictionary = value as? [String: AnyObject] {
      dictionary.forEach { nestedKey, value in
        components += buildComponents(key: "\(key)[\(nestedKey)]", value: value)
      }
    } else if let array = value as? [AnyObject] {<commit_msg>New helper method on query builder<commit_after>import Foundation

struct QueryBuilder {

  typealias Component = (String, String)

  let escapingCharacters = ":#[]@!$&'()*+,;="

  func buildQuery(parameters: [String: AnyObject]) -> String {
    return buildComposents(parameters).map({ "\($0)=\($1)" }).joinWithSeparator("&")
  }

  func buildComposents(parameters: [String: AnyObject]) -> [Component] {
    var components: [Component] = []

    parameters.forEach { key, value in
      components += buildComponents(key: key, value: value)
    }

    return components
  }

  func buildComponents(key key: String, value: AnyObject) -> [Component] {
    var components: [Component] = []

    if let dictionary = value as? [String: AnyObject] {
      dictionary.forEach { nestedKey, value in
        components += buildComponents(key: "\(key)[\(nestedKey)]", value: value)
      }
    } else if let array = value as? [AnyObject] {
{'fraction_non_alphanumeric': 0.15331010452961671, 'fraction_numerical': 0.0023228803716608595, 'mean_word_length': 3.7335164835164836, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 8, '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': '4020803', 'n_tokens_mistral': 510, 'n_tokens_neox': 492, 'n_words': 140}