summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/analysestats/main.go6
-rw-r--r--cmd/dehyphenate/main.go4
-rw-r--r--cmd/dlgbook/main.go4
-rw-r--r--cmd/eeboxmltohocr/main.go6
-rw-r--r--cmd/iiifdownloader/main.go10
-rw-r--r--pkg/hocr/lines.go2
6 files changed, 16 insertions, 16 deletions
diff --git a/cmd/analysestats/main.go b/cmd/analysestats/main.go
index 10be46a..aeb51ca 100644
--- a/cmd/analysestats/main.go
+++ b/cmd/analysestats/main.go
@@ -18,8 +18,8 @@ import (
"math"
"os"
"path/filepath"
- "strings"
"strconv"
+ "strings"
)
const usage = `Usage: analysestats statsdir csvfile
@@ -127,7 +127,7 @@ func getMeanStddevOfBest(bestfn string, conffn string) (float64, float64, error)
for _, v := range bestConfs {
a += (float64(v) - mean) * (float64(v) - mean)
}
- variance := a / float64(len(bestConfs) - 1)
+ variance := a / float64(len(bestConfs)-1)
stddev = math.Sqrt(variance)
}
@@ -153,7 +153,7 @@ func walker(bookstats *Bookstats) filepath.WalkFunc {
if len(parts) < 2 || len(b) < 6 {
return nil
}
- prefix := b[0:len(b)-6] // 6 is length of '-hocr' + 1
+ prefix := b[0 : len(b)-6] // 6 is length of '-hocr' + 1
ext := parts[len(parts)-1]
if ext != "hocr" && ext != "best" {
diff --git a/cmd/dehyphenate/main.go b/cmd/dehyphenate/main.go
index 0974368..284fc1a 100644
--- a/cmd/dehyphenate/main.go
+++ b/cmd/dehyphenate/main.go
@@ -34,7 +34,7 @@ func dehyphenateString(in string) string {
words := strings.Split(line, " ")
last := words[len(words)-1]
// the - 2 here is to account for a trailing newline and counting from zero
- if len(last) > 0 && last[len(last) - 1] == '-' && i < len(lines) - 2 {
+ if len(last) > 0 && last[len(last)-1] == '-' && i < len(lines)-2 {
nextwords := strings.Split(lines[i+1], " ")
if len(nextwords) > 0 {
line = line[0:len(line)-1] + nextwords[0]
@@ -80,7 +80,7 @@ func main() {
for i, l := range h.Lines {
w := l.Words[len(l.Words)-1]
if len(w.Chars) == 0 {
- if len(w.Text) > 0 && w.Text[len(w.Text) - 1] == '-' {
+ if len(w.Text) > 0 && w.Text[len(w.Text)-1] == '-' {
h.Lines[i].Words[len(l.Words)-1].Text = w.Text[0:len(w.Text)-1] + h.Lines[i+1].Words[0].Text
h.Lines[i+1].Words[0].Text = ""
}
diff --git a/cmd/dlgbook/main.go b/cmd/dlgbook/main.go
index 65ac870..6518006 100644
--- a/cmd/dlgbook/main.go
+++ b/cmd/dlgbook/main.go
@@ -78,8 +78,8 @@ func getMetadata(id string) (string, string, string, error) {
// designed to be unmarshalled by encoding/json's Unmarshal()
type bookInfo struct {
VolumeInfo struct {
- Title string
- Authors []string
+ Title string
+ Authors []string
PublishedDate string
}
}
diff --git a/cmd/eeboxmltohocr/main.go b/cmd/eeboxmltohocr/main.go
index 25c4204..5114678 100644
--- a/cmd/eeboxmltohocr/main.go
+++ b/cmd/eeboxmltohocr/main.go
@@ -51,7 +51,7 @@ func addPage(pgs *[]Page, number int, text string) {
if added == 0 {
newpg := Page{number, text}
*pgs = append(*pgs, newpg)
- }
+ }
}
func main() {
@@ -100,14 +100,14 @@ func main() {
}
for _, pg := range pgs {
- fn := fmt.Sprintf("%s-%03d.hocr", flag.Arg(1), pg.number - 1)
+ fn := fmt.Sprintf("%s-%03d.hocr", flag.Arg(1), pg.number-1)
f, err := os.Create(fn)
if err != nil {
log.Fatalf("Could not create file %s: %v\n", fn, err)
}
defer f.Close()
- _, err = io.WriteString(f, hocrHeader + pg.text + hocrFooter)
+ _, err = io.WriteString(f, hocrHeader+pg.text+hocrFooter)
if err != nil {
log.Fatalf("Could not write file %s: %v\n", fn, err)
}
diff --git a/cmd/iiifdownloader/main.go b/cmd/iiifdownloader/main.go
index cbb0d5c..6ae2f52 100644
--- a/cmd/iiifdownloader/main.go
+++ b/cmd/iiifdownloader/main.go
@@ -82,7 +82,7 @@ func parseMets(u string, c *http.Client) ([]string, error) {
// designed to be unmarshalled by encoding/xml's Unmarshal()
type metsXML struct {
FileGrps []struct {
- Attr string `xml:"USE,attr"`
+ Attr string `xml:"USE,attr"`
Files []struct {
Url string `xml:"href,attr"`
} `xml:"file>FLocat"`
@@ -168,8 +168,8 @@ func parseIIIFManifest(u string, c *http.Client) ([]string, error) {
// redirects to a info.json unless we manually add the appropriate
// iiif parameters.
if strings.HasPrefix(u, "https://iiif.bodleian.ox.ac.uk") &&
- !strings.HasSuffix(u, ".jpg") && !strings.HasSuffix(u, ".jpeg") &&
- !strings.HasSuffix(u, ".png") {
+ !strings.HasSuffix(u, ".jpg") && !strings.HasSuffix(u, ".jpeg") &&
+ !strings.HasSuffix(u, ".png") {
u += "/full/full/0/native.jpg"
}
urls = append(urls, u)
@@ -192,7 +192,7 @@ func urlToPgName(u string) string {
}
if b != "default.jpg" && b != "native.jpg" &&
- b != "default.png" && b != "native.png" {
+ b != "default.png" && b != "native.png" {
if path.Ext(b) == "" {
return b + ext
}
@@ -203,7 +203,7 @@ func urlToPgName(u string) string {
if len(f) < 5 {
return safe
}
- name := f[len(f) - 5]
+ name := f[len(f)-5]
f2 := strings.Split(name, "_")
var numpart, pgnum string
diff --git a/pkg/hocr/lines.go b/pkg/hocr/lines.go
index 5794243..36e860a 100644
--- a/pkg/hocr/lines.go
+++ b/pkg/hocr/lines.go
@@ -167,7 +167,7 @@ func GetLineDetailsCustomImg(hocrfn string, imgfn string) (line.Details, error)
return newlines, err
}
- return parseLineDetails(h, filepath.Dir(hocrfn), func(s string) (string, error) {return imgfn, nil})
+ return parseLineDetails(h, filepath.Dir(hocrfn), func(s string) (string, error) { return imgfn, nil })
}
// GetLineBasics parses a hocr file and returns a corresponding