diff options
author | Nick White <git@njw.name> | 2019-05-14 18:02:34 +0100 |
---|---|---|
committer | Nick White <git@njw.name> | 2019-05-14 18:02:34 +0100 |
commit | f49a8a74a8ef2c96cc2bbf34461a8387f7e324d8 (patch) | |
tree | ec3c67a1cd6c5cfb7a787b2936799af72bc18743 /pgconf | |
parent | 544c42ebae13c4f215a0722b4067d4adb715be65 (diff) |
Rewrite pgconf to be more accurate by measuring average word confidence rather than average line confidence
Diffstat (limited to 'pgconf')
-rw-r--r-- | pgconf/main.go | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/pgconf/main.go b/pgconf/main.go index d254f42..bc09c23 100644 --- a/pgconf/main.go +++ b/pgconf/main.go @@ -7,7 +7,6 @@ import ( "os" "rescribe.xyz/go.git/lib/hocr" - "rescribe.xyz/go.git/lib/line" ) func main() { @@ -22,31 +21,10 @@ func main() { os.Exit(1) } - var err error - lines := make(line.Details, 0) - - for _, f := range flag.Args() { - var newlines line.Details - newlines, err = hocr.GetLineBasics(f) - if err != nil { - log.Fatal(err) - } - - for _, l := range newlines { - lines = append(lines, l) - } - } - - if len(lines) == 0 { - fmt.Printf("No lines found\n") - os.Exit(0) - } - - var total float64 - for _, l := range lines { - total += l.Avgconf + avg, err := hocr.GetAvgConf(flag.Arg(0)) + if err != nil { + log.Fatalf("Error retreiving confidence for %s: %v\n", flag.Arg(0), err) } - avg := total / float64(len(lines)) - fmt.Printf("%0.0f\n", avg * 100) + fmt.Printf("%0.0f\n", avg) } |