Update Tesseract to version 4.

This commit is contained in:
Damiano Galassi committed 2019-06-01 14:22:36 +02:00
1 parent 9269f31d37
commit 93a09b634a
3 files changed
+12 -13

No files matched your search

+11 -10
View File
@@ -159,7 +159,7 @@ final class OCRManager {
OCRLanguage(langCode: "kk", name: "kaz.traineddata"),
OCRLanguage(langCode: "km", name: "khm.traineddata"),
OCRLanguage(langCode: "ky", name: "kir.traineddata"),
// OCRLanguage(langCode: "kmr", name: "kmr.traineddata"),
OCRLanguage(langCode: "ku", name: "kmr.traineddata"),
OCRLanguage(langCode: "ko", name: "kor.traineddata"),
// OCRLanguage(langCode: "kor_vert", name: "kor_vert.traineddata"),
OCRLanguage(langCode: "lo", name: "lao.traineddata"),
@@ -229,16 +229,16 @@ final class OCRManager {
NotificationCenter.default.post(name: OCRManager.updateNotification, object: self)
}
private func destinationURL() -> URL? {
return FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first?.appendingPathComponent("Subler", isDirectory: true).appendingPathComponent("tessdata", isDirectory: true)
}
private lazy var destinationURL = {
return FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first?.appendingPathComponent("Subler", isDirectory: true).appendingPathComponent("tessdata", isDirectory: true).appendingPathComponent("v4", isDirectory: true)
}()
private func baseURL() -> URL? {
return URL(string: "https://github.com/tesseract-ocr/tessdata_fast/raw/master/")
}
private lazy var baseURL = {
return URL(string: "https://github.com/tesseract-ocr/tessdata/raw/master/")
}()
func download(item: OCRLanguage) {
if let baseURL = baseURL(), let destURL = destinationURL() {
if let baseURL = baseURL, let destURL = destinationURL {
_ = item.startDownload(from: baseURL, to: destURL, completionHandler: { _ in self.postNotification() })
postNotification()
}
@@ -249,7 +249,7 @@ final class OCRManager {
}
func removeDownload(item: OCRLanguage) throws {
if let destURL = destinationURL() {
if let destURL = destinationURL {
try item.remove(destURL)
postNotification()
}
@@ -258,7 +258,8 @@ final class OCRManager {
// MARK: read/write
private func load() throws {
if let destinationURL = destinationURL() {
if let destinationURL = destinationURL {
try FileManager.default.createDirectory(at: destinationURL, withIntermediateDirectories: true, attributes: [:])
languages.forEach { $0.checkIfDownloaded(destinationURL) }
}
}
-2
View File
@@ -289,7 +289,6 @@
A97D99D922A0240C001FA3A7 /* OCRManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = OCRManager.swift; path = Classes/OCRManager.swift; sourceTree = "<group>"; };
A97FBE3B21FC7F1C00F1FD35 /* QueueController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = QueueController.swift; path = Classes/QueueController.swift; sourceTree = "<group>"; };
A983E80A22365B5400221BAE /* MovieViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MovieViewController.swift; path = Classes/PropertyView/MovieViewController.swift; sourceTree = "<group>"; };
A984DB4A0F52D644001A20B2 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; };
A984DB730F52DD4B001A20B2 /* dsa_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dsa_pub.pem; sourceTree = "<group>"; };
A98542D620D197D300EB9803 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ArtworkSelector.xib; sourceTree = "<group>"; };
A98542D820D197DF00EB9803 /* ArtworkSelector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ArtworkSelector.swift; path = Classes/ArtworkSelector.swift; sourceTree = "<group>"; };
@@ -404,7 +403,6 @@
children = (
A9ED7B21180067A2008FD3A8 /* IOKit.framework */,
2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */,
A984DB4A0F52D644001A20B2 /* Sparkle.framework */,
1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */,
);
name = "Linked Frameworks";