<commit_before>//
//  StringExtension.swift
//  Soundcloud
//
//  Created by <NAME> on 07/05/15.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

import UIKit

// MARK: - StringExtension
////////////////////////////////////////////////////////////////////////////

extension String: HTTPParametersConvertible {
    var stringValue: String {
        return self
    }

    var dataValue: NSData {
        return self.dataUsingEncoding(NSUTF8StringEncoding) ?? NSData()
    }
}

////////////////////////////////////////////////////////////////////////////<commit_msg>Added a way to get a Dictionary back from queryString<commit_after>//
//  StringExtension.swift
//  Soundcloud
//
//  Created by <NAME> on 07/05/15.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

import UIKit

// MARK: - StringExtension
////////////////////////////////////////////////////////////////////////////

extension String: HTTPParametersConvertible {
    var stringValue: String {
        return self
    }

    var dataValue: NSData {
        return self.dataUsingEncoding(NSUTF8StringEncoding) ?? NSData()
    }
}

extension String {
    var queryDictionary: [String: String] {
        let parameters = componentsSeparatedByString("&")
        var dictionary = [String: String]()
        for parameter in parameters {
            let keyValue = parameter.componentsSeparatedByString("=")
            if keyValue.count == 2 {
                if let key = keyValue[0].stringByRemovingPercentEncoding,
                    value = keyValue[1].stringByRemovingPercentEncoding {
                        dictionary[keyValue[0]] = keyValue[1]
                }
            }
        }
        return dictionary
    }
}

////////////////////////////////////////////////////////////////////////////
{'fraction_non_alphanumeric': 0.2549129702414374, 'fraction_numerical': 0.015160022459292532, 'mean_word_length': 1.3540290620871862, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2364180', 'n_tokens_mistral': 443, 'n_tokens_neox': 413, 'n_words': 108}