summaryrefslogtreecommitdiff
path: root/parse/line.go
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-01-23 21:54:09 +0000
committerNick White <git@njw.name>2019-01-23 21:54:15 +0000
commitfb77852acbdbbcedcdb9771770cb6771da002851 (patch)
tree233b6cedea313702c994919906d156d829ed378e /parse/line.go
parentd256f967a26ceeb7c3987a1fc447b126a35054f9 (diff)
Update line-conf-buckets to mostly use package functions too.
Working now, but needs more consolidation to be worth it.
Diffstat (limited to 'parse/line.go')
-rw-r--r--parse/line.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/parse/line.go b/parse/line.go
index 3ddde76..9a2be8e 100644
--- a/parse/line.go
+++ b/parse/line.go
@@ -9,6 +9,7 @@ import (
"image"
"image/png"
"io"
+ "os"
)
type LineDetail struct {
@@ -16,7 +17,7 @@ type LineDetail struct {
Avgconf float64
Img CopyableLine
Text string
- Hocrname string
+ OcrName string
}
type CopyableLine interface {
@@ -37,6 +38,21 @@ func (i ImgDirect) CopyLineTo(w io.Writer) (error) {
return nil
}
+type ImgPath struct {
+ Path string
+}
+
+func (i ImgPath) CopyLineTo(w io.Writer) (error) {
+ f, err := os.Open(i.Path)
+ if err != nil {
+ return err
+ }
+ defer f.Close()
+
+ _, err = io.Copy(w, f)
+ return err
+}
+
type LineDetails []LineDetail
// Used by sort.Sort.