summaryrefslogtreecommitdiff
path: root/parse/line.go
diff options
context:
space:
mode:
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.