diff options
author | Nick White <git@njw.name> | 2019-05-14 11:20:33 +0100 |
---|---|---|
committer | Nick White <git@njw.name> | 2019-05-14 11:20:33 +0100 |
commit | 6b4e704befb7f82627d2c9a4e3f4e2971fdaf883 (patch) | |
tree | dcc721c2791377ceeb193f80941a9ad76483e380 /lib/hocr/lines.go | |
parent | 94601a82bd3db51b749a1e44ad116250ba545bee (diff) |
Add pgconf tool that prints the overall confidence for a whole page of hocr
Diffstat (limited to 'lib/hocr/lines.go')
-rw-r--r-- | lib/hocr/lines.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/hocr/lines.go b/lib/hocr/lines.go index 20c6550..74e8f9a 100644 --- a/lib/hocr/lines.go +++ b/lib/hocr/lines.go @@ -112,3 +112,20 @@ func GetLineDetails(hocrfn string) (line.Details, error) { n := strings.Replace(filepath.Base(hocrfn), ".hocr", "", 1) return parseLineDetails(h, img, n) } + +func GetLineBasics(hocrfn string) (line.Details, error) { + var newlines line.Details + + file, err := ioutil.ReadFile(hocrfn) + if err != nil { + return newlines, err + } + + h, err := Parse(file) + if err != nil { + return newlines, err + } + + n := strings.Replace(filepath.Base(hocrfn), ".hocr", "", 1) + return parseLineDetails(h, nil, n) +} |