summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-05-14 11:20:33 +0100
committerNick White <git@njw.name>2019-05-14 11:20:33 +0100
commit6b4e704befb7f82627d2c9a4e3f4e2971fdaf883 (patch)
treedcc721c2791377ceeb193f80941a9ad76483e380 /lib
parent94601a82bd3db51b749a1e44ad116250ba545bee (diff)
Add pgconf tool that prints the overall confidence for a whole page of hocr
Diffstat (limited to 'lib')
-rw-r--r--lib/hocr/lines.go17
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)
+}