gocropy

package module
v0.0.0-...-a6d7a8d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2016 License: MIT Imports: 15 Imported by: 0

README

Gocropy

Library to process ocropy's hocr files

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bbox

type Bbox struct {
	Left, Top, Right, Bottom int
}

func TokenizeChars

func TokenizeChars(chars []Char) (string, Bbox)

func (*Bbox) Add

func (bbox *Bbox) Add(other Bbox)

func (*Bbox) AddSlice

func (bbox *Bbox) AddSlice(bboxes []Bbox)

func (*Bbox) Sanitize

func (bbox *Bbox) Sanitize(page Bbox)

func (*Bbox) Scan

func (bbox *Bbox) Scan(state fmt.ScanState, verb rune) error

func (Bbox) String

func (bbox Bbox) String() string

type Char

type Char struct {
	Box  Bbox
	Rune rune
}

func CharsFromLlocs

func CharsFromLlocs(llocs []Lloc, bbox Bbox) []Char

func (Char) String

func (char Char) String() string

type HOCR

type HOCR struct {
	XMLName xml.Name
	Head    HOCRHead `xml:"head"`
	Body    HOCRBody `xml:"body"`
	File    string   `xml:"-"`
}

func MustReadHOCR

func MustReadHOCR(file string) *HOCR

func ReadHOCR

func ReadHOCR(file string) (*HOCR, error)

func (*HOCR) ConvertToHOCR

func (hocr *HOCR) ConvertToHOCR(dir string) error

func (*HOCR) MustConvertToHOCR

func (hocr *HOCR) MustConvertToHOCR(dir string)

func (*HOCR) ReadImageFileBbox

func (hocr *HOCR) ReadImageFileBbox() (*Bbox, error)

type HOCRBody

type HOCRBody struct {
	Div HOCRDiv `xml:"div"`
}

type HOCRClass

type HOCRClass struct {
	Class string `xml:"class,attr"`
}

type HOCRDiv

type HOCRDiv struct {
	HOCRClass
	HOCRTitle
	Spans []HOCRSpan `xml:"span"`
}

type HOCRHead

type HOCRHead struct {
	Title string     `xml:"title"`
	Metas []HOCRMeta `xml:"meta"`
}

type HOCRMeta

type HOCRMeta struct {
	HttpEquiv string `xml:"http-equiv,attr,omitempty"`
	Name      string `xml:"name,attr,omitempty"`
	Content   string `xml:"content,attr"`
}

type HOCRSpan

type HOCRSpan struct {
	HOCRClass
	HOCRTitle
	Data  string     `xml:",chardata"`
	Token []HOCRSpan `xml:"span"`
}

type HOCRTitle

type HOCRTitle struct {
	Title string `xml:"title,attr"`
}

func (HOCRTitle) GetBbox

func (title HOCRTitle) GetBbox() Bbox

func (HOCRTitle) GetFile

func (title HOCRTitle) GetFile() string

func (*HOCRTitle) SetBbox

func (title *HOCRTitle) SetBbox(bbox Bbox)

func (*HOCRTitle) SetCuts

func (title *HOCRTitle) SetCuts(chars []Char)

func (*HOCRTitle) SetFile

func (title *HOCRTitle) SetFile(file string)

type Lloc

type Lloc struct {
	Codepoint  rune
	Adjustment float64
}

func MustReadLlocs

func MustReadLlocs(file string) []Lloc

func ReadLlocs

func ReadLlocs(file string) ([]Lloc, error)

func (Lloc) String

func (lloc Lloc) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL