summaryrefslogtreecommitdiff
path: root/cmd/rescribe
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/rescribe')
-rw-r--r--cmd/rescribe/getembeds.go4
-rw-r--r--cmd/rescribe/main.go7
2 files changed, 6 insertions, 5 deletions
diff --git a/cmd/rescribe/getembeds.go b/cmd/rescribe/getembeds.go
index a3edaf2..1747d82 100644
--- a/cmd/rescribe/getembeds.go
+++ b/cmd/rescribe/getembeds.go
@@ -11,9 +11,9 @@ package main
import (
"fmt"
"io"
+ "net/http"
"os"
"path"
- "net/http"
)
func dl(url string) error {
@@ -40,7 +40,7 @@ func dl(url string) error {
}
func main() {
- urls := []string {
+ urls := []string{
"https://rescribe.xyz/rescribe/embeds/tessdata.20210622.zip",
"https://rescribe.xyz/rescribe/embeds/tesseract-linux-v5.0.0-alpha.20210510.zip",
"https://rescribe.xyz/rescribe/embeds/tesseract-osx-v4.1.1.20191227.zip",
diff --git a/cmd/rescribe/main.go b/cmd/rescribe/main.go
index 4404789..db8eb41 100644
--- a/cmd/rescribe/main.go
+++ b/cmd/rescribe/main.go
@@ -46,6 +46,7 @@ var tessdatazip []byte
const QueueTimeoutSecs = 2 * 60
const PauseBetweenChecks = 1 * time.Second
const LogSaveTime = 1 * time.Minute
+
var thresholds = []float64{0.1, 0.2, 0.3}
// null writer to enable non-verbose logging to be discarded
@@ -322,8 +323,8 @@ These training files are included in rescribe, and are always available:
}
// For simplicity, remove .binarised.pdf and rename .colour.pdf to .pdf
- _ = os.Remove(filepath.Join(savedir, bookname + ".binarised.pdf"))
- _ = os.Rename(filepath.Join(savedir, bookname + ".colour.pdf"), filepath.Join(savedir, bookname + ".pdf"))
+ _ = os.Remove(filepath.Join(savedir, bookname+".binarised.pdf"))
+ _ = os.Rename(filepath.Join(savedir, bookname+".colour.pdf"), filepath.Join(savedir, bookname+".pdf"))
}
func addTxtVersion(hocrfn string) error {
@@ -342,7 +343,7 @@ func addTxtVersion(hocrfn string) error {
for _, v := range thresholds {
basefn = strings.TrimSuffix(basefn, fmt.Sprintf("_bin%.1f.hocr", v))
}
- fn := filepath.Join(dir, "text", basefn + ".txt")
+ fn := filepath.Join(dir, "text", basefn+".txt")
err = ioutil.WriteFile(fn, []byte(t), 0644)
if err != nil {