this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

minor updates

alice 690a02c0 de2fcd5b

+14 -8
+11 -1
OCR.xcodeproj/project.pbxproj
··· 78 78 dependencies = ( 79 79 ); 80 80 name = OCR; 81 + packageProductDependencies = ( 82 + ); 81 83 productName = OCR; 82 84 productReference = BE023CCA296174C9001F4E9F /* OCR */; 83 85 productType = "com.apple.product-type.tool"; ··· 90 92 attributes = { 91 93 BuildIndependentTargetsInParallel = 1; 92 94 LastSwiftUpdateCheck = 1310; 93 - LastUpgradeCheck = 1310; 95 + LastUpgradeCheck = 1500; 94 96 TargetAttributes = { 95 97 BE023CC9296174C9001F4E9F = { 96 98 CreatedOnToolsVersion = 13.1; ··· 106 108 Base, 107 109 ); 108 110 mainGroup = BE023CC1296174C9001F4E9F; 111 + packageReferences = ( 112 + ); 109 113 productRefGroup = BE023CCB296174C9001F4E9F /* Products */; 110 114 projectDirPath = ""; 111 115 projectRoot = ""; ··· 161 165 CLANG_WARN_UNREACHABLE_CODE = YES; 162 166 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 163 167 COPY_PHASE_STRIP = NO; 168 + DEAD_CODE_STRIPPING = YES; 164 169 DEBUG_INFORMATION_FORMAT = dwarf; 165 170 ENABLE_STRICT_OBJC_MSGSEND = YES; 166 171 ENABLE_TESTABILITY = YES; 172 + ENABLE_USER_SCRIPT_SANDBOXING = YES; 167 173 GCC_C_LANGUAGE_STANDARD = gnu11; 168 174 GCC_DYNAMIC_NO_PIC = NO; 169 175 GCC_NO_COMMON_BLOCKS = YES; ··· 222 228 CLANG_WARN_UNREACHABLE_CODE = YES; 223 229 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 224 230 COPY_PHASE_STRIP = NO; 231 + DEAD_CODE_STRIPPING = YES; 225 232 DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 226 233 ENABLE_NS_ASSERTIONS = NO; 227 234 ENABLE_STRICT_OBJC_MSGSEND = YES; 235 + ENABLE_USER_SCRIPT_SANDBOXING = YES; 228 236 GCC_C_LANGUAGE_STANDARD = gnu11; 229 237 GCC_NO_COMMON_BLOCKS = YES; 230 238 GCC_WARN_64_TO_32_BIT_CONVERSION = YES; ··· 246 254 isa = XCBuildConfiguration; 247 255 buildSettings = { 248 256 CODE_SIGN_STYLE = Automatic; 257 + DEAD_CODE_STRIPPING = YES; 249 258 MACOSX_DEPLOYMENT_TARGET = 14.0; 250 259 PRODUCT_NAME = "$(TARGET_NAME)"; 251 260 SWIFT_VERSION = 5.0; ··· 256 265 isa = XCBuildConfiguration; 257 266 buildSettings = { 258 267 CODE_SIGN_STYLE = Automatic; 268 + DEAD_CODE_STRIPPING = YES; 259 269 MACOSX_DEPLOYMENT_TARGET = 14.0; 260 270 PRODUCT_NAME = "$(TARGET_NAME)"; 261 271 SWIFT_VERSION = 5.0;
+3 -7
OCR/main.swift
··· 12 12 var USE_LANG_CORRECTION = true 13 13 var REVISION = VNRecognizeTextRequestRevision3 14 14 func main(args: [String]) -> Int32 { 15 - let language = "en-US" 16 - var languages:[String] = [] 17 - languages.append(language) 15 + let languages:[String] = ["en-US"] 18 16 let url = URL(fileURLWithPath: args[1]) 19 17 var files = [URL]() 20 18 if let enumerator = FileManager.default.enumerator(at: url, includingPropertiesForKeys: [.isRegularFileKey], options: [.skipsHiddenFiles, .skipsPackageDescendants]) { ··· 38 36 fputs("Error: failed to convert NSImage to CGImage for '\(file)'\n", stderr) 39 37 return 1 40 38 } 41 - 39 + 42 40 let request = VNRecognizeTextRequest { (request, error) in 43 41 let observations = request.results as? [VNRecognizedTextObservation] ?? [] 44 42 var dict:[String:Any] = [:] 45 43 var lines:[Any] = [] 46 44 var allText = "" 47 - var index = 0 48 - for observation in observations { 45 + for (index, observation) in observations.enumerated() { 49 46 // Find the top observation. 50 47 var line:[String:Any] = [:] 51 48 let candidate = observation.topCandidates(1).first ··· 70 67 line["height"] = Int(rect.size.height) 71 68 lines.append(line) 72 69 allText = allText + (string ?? "") 73 - index = index + 1 74 70 if index != observations.count { 75 71 allText = allText + "\n" 76 72 }