hocr

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ClassPage = "ocr_page"
	ClassArea = "ocr_carea"
	ClassLine = "ocr_line"
	ClassWord = "ocrx_word"
)

Possible classes for elements

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is the error that is returned if a attribute of an element could not found.

Functions

This section is empty.

Types

type Element added in v0.7.1

type Element struct {
	Class string
	Node  xml.StartElement
}

Element is used to represent text elements in the hOCR document.

func (Element) BBox added in v0.7.1

func (e Element) BBox() image.Rectangle

BBox returns the bounding box of the element. If the element does not have a bounding box, the empty boundingbox (0,0)-(0,0) is returned.

func (Element) Scanf added in v0.7.1

func (e Element) Scanf(attr, key, format string, args ...interface{}) (int, error)

Scanf is used to read values of the different element attributes. Use like this: e.Scanf("title", "image", "%s", &str)

type Node added in v0.7.1

type Node interface{}

Node represents hOCR nodes returned by the scanner.

type Scanner added in v0.7.1

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner is a low-level scanner for hOCR documents.

func NewScanner added in v0.7.1

func NewScanner(r io.Reader) *Scanner

NewScanner creates a new hocr.Scanner

func (*Scanner) Err added in v0.7.1

func (s *Scanner) Err() error

Err returns the last error.

func (*Scanner) Node added in v0.7.1

func (s *Scanner) Node() Node

Node returns the last scanned node.

func (*Scanner) Scan added in v0.7.1

func (s *Scanner) Scan() bool

Scan scans the next element in the document. It returns true if a new element could be read.

type Text added in v0.7.1

type Text string

Text is just a typedef for a string.

Jump to

Keyboard shortcuts

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