summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/confgraph/main.go5
-rw-r--r--graph.go5
2 files changed, 9 insertions, 1 deletions
diff --git a/cmd/confgraph/main.go b/cmd/confgraph/main.go
index 9b158f3..ed5ce93 100644
--- a/cmd/confgraph/main.go
+++ b/cmd/confgraph/main.go
@@ -22,6 +22,9 @@ func walker(confs *[]*bookpipeline.Conf) filepath.WalkFunc {
}
avg, err := hocr.GetAvgConf(path)
if err != nil {
+ if err.Error() == "No words found" {
+ return nil
+ }
return err
}
c := bookpipeline.Conf{
@@ -35,7 +38,7 @@ func walker(confs *[]*bookpipeline.Conf) filepath.WalkFunc {
func main() {
flag.Usage = func() {
- fmt.Fprintln(flag.CommandLine.Output(), "Usage: bookpipeline hocrdir graph.png")
+ fmt.Fprintln(flag.CommandLine.Output(), "Usage: confgraph hocrdir graph.png")
flag.PrintDefaults()
}
flag.Parse()
diff --git a/graph.go b/graph.go
index 955abbd..1604d06 100644
--- a/graph.go
+++ b/graph.go
@@ -1,6 +1,7 @@
package bookpipeline
import (
+ "errors"
"fmt"
"io"
"path/filepath"
@@ -61,6 +62,10 @@ func Graph(confs map[string]*Conf, bookname string, w io.Writer) error {
}
sort.Slice(graphconf, func(i, j int) bool { return graphconf[i].Pgnum < graphconf[j].Pgnum })
+ if len(graphconf) == 0 {
+ return errors.New("No valid confidences")
+ }
+
// Create main xvalues and yvalues, annotations and ticks
var xvalues, yvalues []float64
var annotations []chart.Value2