dawg

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Graph
	// contains filtered or unexported fields
}

Builder represents the structure of Directed Acyclic Word Graph builder.

func NewBuilder

func NewBuilder() *Builder

NewBuilder returns a DAWG builder.

func (*Builder) Finish

func (b *Builder) Finish() (*Graph, error)

Finish finishes a building DAWG.

func (*Builder) Insert

func (b *Builder) Insert(key string, value uint32) error

Insert inserts the word and the value to a DAWG.

type Graph

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

Graph represents the Directed Acyclic Word Graph.

func (Graph) Child

func (g Graph) Child(id uint32) (uint32, error)

Child returns the child unit ID of a unit.

func (Graph) IntersectionID

func (g Graph) IntersectionID(id uint32) (int, error)

IntersectionID returns the intersection unit ID.

func (Graph) IsIntersection

func (g Graph) IsIntersection(id uint32) (bool, error)

IsIntersection is true if a unit is intersection of other units.

func (Graph) IsLeaf

func (g Graph) IsLeaf(id uint32) (bool, error)

IsLeaf is true if unit has no sibling.

func (Graph) Label

func (g Graph) Label(id uint32) (byte, error)

Label returns the character byte of a unit.

func (Graph) NumIntersections

func (g Graph) NumIntersections() int

NumIntersections returns the number of intersection units.

func (Graph) Root

func (g Graph) Root() uint32

Root returns the root ID.

func (Graph) Sibling

func (g Graph) Sibling(id uint32) (uint32, error)

Sibling returns the sibling unit ID of a unit.

func (Graph) Size

func (g Graph) Size() int

Size returns the graph size.

func (Graph) Value

func (g Graph) Value(id uint32) (uint32, error)

Value returns the value of a unit.

Jump to

Keyboard shortcuts

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