sketch

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: BSD-3-Clause Imports: 22 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncompleteConfig = sketcherror.ErrIncompleteConfig
	ErrBadConfig        = sketcherror.ErrBadConfig

	ErrNodeFeatureUnavailable = errors.New("node feature unavailable")
	ErrNodePositionUnknown    = errors.New("node position unknown")
)

Functions

This section is empty.

Types

type DocumentReport

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

DocumentReport is the result of a document analysis.

func (*DocumentReport) AsProto

func (*DocumentReport) Pages

func (r *DocumentReport) Pages() []*PageReport

func (*DocumentReport) Tags

func (r *DocumentReport) Tags() []string

type Node

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

func (*Node) AsProto

func (n *Node) AsProto(unit geometry.LengthUnit) *reportpb.Node

func (*Node) Bounds

func (n *Node) Bounds() geometry.Rect

func (*Node) FeaturePosition

func (n *Node) FeaturePosition(feature sketchpb.NodeFeature) (geometry.Point, error)

func (*Node) Name

func (n *Node) Name() string

func (*Node) SearchAreas

func (n *Node) SearchAreas() []geometry.Rect

func (*Node) Tags

func (n *Node) Tags() []string

func (*Node) Text

func (n *Node) Text() string

func (*Node) TextMatch

func (n *Node) TextMatch() *TextMatch

func (*Node) Valid

func (n *Node) Valid() bool

type PageReport

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

func (*PageReport) AsProto

func (p *PageReport) AsProto(unit geometry.LengthUnit) *reportpb.Page

func (*PageReport) NodeByName

func (p *PageReport) NodeByName(name string) *Node

func (*PageReport) NodeFeaturePosition

func (p *PageReport) NodeFeaturePosition(name string, feature sketchpb.NodeFeature) (geometry.Point, error)

func (*PageReport) Nodes

func (p *PageReport) Nodes() []*Node

func (*PageReport) Number

func (p *PageReport) Number() int

Number returns the 1-based page number.

func (*PageReport) Size

func (p *PageReport) Size() geometry.Size

type Sketch

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

func Compile

func Compile(pb *sketchpb.Sketch) (*Sketch, error)

func CompileFromTextproto

func CompileFromTextproto(b []byte) (*Sketch, error)

func CompileFromTextprotoString

func CompileFromTextprotoString(s string) (*Sketch, error)

func (*Sketch) AnalyzeDocument

func (s *Sketch) AnalyzeDocument(ctx context.Context, doc *dossier.Document, r pagerange.Range) (*DocumentReport, error)

func (*Sketch) AnalyzePage

func (s *Sketch) AnalyzePage(p *dossier.Page) (*PageReport, error)

func (*Sketch) AnalyzePages

func (s *Sketch) AnalyzePages(pages []*dossier.Page) ([]*PageReport, error)

func (*Sketch) Tags

func (s *Sketch) Tags() []string

type TextMatch

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

TextMatch captures information about a regular expression match in a string.

func (*TextMatch) Group

func (m *TextMatch) Group(idx int) *TextMatchGroup

Group returns a subgroup by index or nil if it's not captured.

func (*TextMatch) Groups

func (m *TextMatch) Groups() []TextMatchGroup

Groups returns a slice with all subgroups of the match.

func (*TextMatch) MustGroup

func (m *TextMatch) MustGroup(idx int) TextMatchGroup

MustGroup returns a subgroup by index or panics if it's not captured.

func (*TextMatch) MustNamed

func (m *TextMatch) MustNamed(name string) TextMatchGroup

Group returns a subgroup by name or panics if it's not captured.

func (*TextMatch) Named

func (m *TextMatch) Named(name string) *TextMatchGroup

Group returns a subgroup by name or nil if it's not captured.

func (*TextMatch) Pattern

func (m *TextMatch) Pattern() string

Pattern returns the pattern source text for the matched regular expression.

type TextMatchGroup

type TextMatchGroup struct {
	// Capture group name. Empty if no name is set using (?P<...>).
	Name string

	// Zero-based start and end offset of the group in the original string.
	Start int
	End   int

	// Text captured by the group.
	Text string
}

func (*TextMatchGroup) AsProto

func (g *TextMatchGroup) AsProto() *reportpb.TextMatchGroup

Jump to

Keyboard shortcuts

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