lattice

package
Version: v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package lattice implements the core of the morph analyzer.

Index

Constants

View Source
const BosEosID int = -1

BosEosID represents Reserved identifier of node id.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lattice

type Lattice struct {
	Input  string
	Output []*node
	// contains filtered or unexported fields
}

Lattice represents a grid of morph nodes.

func New

func New(d *dict.Dict, u *dict.UserDict) *Lattice

New returns a new lattice.

func (*Lattice) Backward

func (la *Lattice) Backward(m TokenizeMode)

Backward runs backward algorithm of the Viterbi.

func (*Lattice) Build

func (la *Lattice) Build(inp string)

Build builds a lattice from the inputs. nolint: gocyclo

func (*Lattice) Dot

func (la *Lattice) Dot(w io.Writer)

Dot outputs a lattice in the graphviz dot format.

func (*Lattice) Forward

func (la *Lattice) Forward(m TokenizeMode)

Forward runs forward algorithm of the Viterbi.

func (*Lattice) Free

func (la *Lattice) Free()

Free releases a memory of a lattice.

func (*Lattice) String

func (la *Lattice) String() string

String returns a debug string of a lattice.

type NodeClass

type NodeClass int

NodeClass represents a node type.

const (
	DUMMY NodeClass = iota
	KNOWN
	UNKNOWN
	USER
)

NodeClass codes.

func (NodeClass) String

func (nc NodeClass) String() string

String returns a string representation of a node class.

type TokenizeMode

type TokenizeMode int

TokenizeMode represents how to tokenize sentence.

const (
	// Normal Mode
	Normal TokenizeMode = iota + 1
	// Search Mode
	Search
	// Extended Mode
	Extended
)

Jump to

Keyboard shortcuts

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