diff options
author | Nick White <git@njw.name> | 2019-01-23 21:54:09 +0000 |
---|---|---|
committer | Nick White <git@njw.name> | 2019-01-23 21:54:15 +0000 |
commit | fb77852acbdbbcedcdb9771770cb6771da002851 (patch) | |
tree | 233b6cedea313702c994919906d156d829ed378e /parse/line.go | |
parent | d256f967a26ceeb7c3987a1fc447b126a35054f9 (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.go | 18 |
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. |