<commit_before>//
//  Location.swift
//  LocationPicker
//
//  Created by <NAME> on 7/29/15.
//  Copyright (c) 2015 almassapargali. All rights reserved.
//

import Foundation

import CoreLocation
import AddressBookUI

// class because protocol
public class Location: NSObject {
	public let name: String?
	
	// difference from placemark location is that if location was reverse geocoded,
	// then location point to user selected location
	public let location: CLLocation
	public let placemark: CLPlacemark
	
	var address: String {
		// try to build full address first
		if let lines = placemark.addressDictionary["FormattedAddressLines"] as? [String] {
			return join(", ", lines)
		} else {
			// fallback
			return ABCreateStringWithAddressDictionary(placemark.addressDictionary, true)
		}<commit_msg>do not assume addressDictionary is present in case user creates Location<commit_after>//
//  Location.swift
//  LocationPicker
//
//  Created by <NAME> on 7/29/15.
//  Copyright (c) 2015 almassapargali. All rights reserved.
//

import Foundation

import CoreLocation
import AddressBookUI

// class because protocol
public class Location: NSObject {
	public let name: String?
	
	// difference from placemark location is that if location was reverse geocoded,
	// then location point to user selected location
	public let location: CLLocation
	public let placemark: CLPlacemark
	
	var address: String {
		// try to build full address first
		if let addressDic = placemark.addressDictionary {
			if let lines = addressDic["FormattedAddressLines"] as? [String] {
				return join(", ", lines)
			} else {
				// fallback
				return ABCreateStringWithAddressDictionary(addressDic, true)
			}
		} else {
			return "\(coordinate.latitude), \(coordinate.longitude)"
		}
{'fraction_non_alphanumeric': 0.08683314415437003, 'fraction_numerical': 0.01021566401816118, 'mean_word_length': 3.739247311827957, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2483893', 'n_tokens_mistral': 539, 'n_tokens_neox': 493, 'n_words': 180}