diff options
author | Nick White <git@njw.name> | 2019-09-05 22:24:37 +0100 |
---|---|---|
committer | Nick White <git@njw.name> | 2019-09-05 22:42:30 +0100 |
commit | 561d8461cbe19316762489cd7b04f95b9014bcda (patch) | |
tree | 7d3409f3279174cab7707b024353d602d3a5f18e /bookpipeline/cmd | |
parent | 60a198f7ee5843a0f77b6dfb845c3b0413e83705 (diff) |
Handle no words found error in a better way so any page that is actually 0 confidence is recognised
Diffstat (limited to 'bookpipeline/cmd')
-rw-r--r-- | bookpipeline/cmd/bookpipeline/main.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bookpipeline/cmd/bookpipeline/main.go b/bookpipeline/cmd/bookpipeline/main.go index 97f4109..ec6a08d 100644 --- a/bookpipeline/cmd/bookpipeline/main.go +++ b/bookpipeline/cmd/bookpipeline/main.go @@ -149,6 +149,9 @@ func analyse(toanalyse chan string, up chan string, errc chan error, logger *log } logger.Println("Calculating confidence for", path) avg, err := hocr.GetAvgConf(path) + if err != nil && err.Error() == "No words found" { + continue + } if err != nil { for range toanalyse { } // consume the rest of the receiving channel so it isn't blocked @@ -156,9 +159,6 @@ func analyse(toanalyse chan string, up chan string, errc chan error, logger *log errc <- errors.New(fmt.Sprintf("Error retreiving confidence for %s: %s", path, err)) return } - if avg == 0 { - continue - } base := filepath.Base(path) codestart := strings.Index(base, "_bin") name := base[0:codestart] |