marisa

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

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

Go to latest
Published: Oct 10, 2019 License: MIT Imports: 4 Imported by: 0

README

marisa

Go bindings for marisa-trie

Installation

go get github.com/okzk/marisa

License

MIT

note:
This license is only applied to go binding implementations.
Therefore, you also need to accept marisa-trie license.

Documentation

Index

Constants

View Source
const (
	MARISA_MIN_NUM_TRIES     = C.MARISA_MIN_NUM_TRIES
	MARISA_MAX_NUM_TRIES     = C.MARISA_MAX_NUM_TRIES
	MARISA_DEFAULT_NUM_TRIES = C.MARISA_DEFAULT_NUM_TRIES
)
View Source
const (
	MARISA_HUGE_CACHE    CacheLevel = C.MARISA_HUGE_CACHE
	MARISA_LARGE_CACHE              = C.MARISA_LARGE_CACHE
	MARISA_NORMAL_CACHE             = C.MARISA_NORMAL_CACHE
	MARISA_SMALL_CACHE              = C.MARISA_SMALL_CACHE
	MARISA_TINY_CACHE               = C.MARISA_TINY_CACHE
	MARISA_DEFAULT_CACHE            = C.MARISA_NORMAL_CACHE
)
View Source
const (
	MARISA_TEXT_TAIL    TailMode = C.MARISA_TEXT_TAIL
	MARISA_BINARY_TAIL           = C.MARISA_BINARY_TAIL
	MARISA_DEFAULT_TAIL          = C.MARISA_TEXT_TAIL
)
View Source
const (
	MARISA_LABEL_ORDER   NodeOrder = C.MARISA_LABEL_ORDER
	MARISA_WEIGHT_ORDER            = C.MARISA_WEIGHT_ORDER
	MARISA_DEFAULT_ORDER           = C.MARISA_WEIGHT_ORDER
)

Variables

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

Functions

This section is empty.

Types

type BuildOption

type BuildOption struct {
	NumTries   int
	CacheLevel CacheLevel
	TailMode   TailMode
	NodeOrder  NodeOrder
}

func NewBuildOption

func NewBuildOption() *BuildOption

type CacheLevel

type CacheLevel int

type Keyset

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

func NewKeyset

func NewKeyset() *Keyset

func (*Keyset) Build

func (k *Keyset) Build() (*Trie, error)

func (*Keyset) BuildWithOption

func (k *Keyset) BuildWithOption(option *BuildOption) (*Trie, error)

func (*Keyset) Dispose

func (k *Keyset) Dispose()

func (*Keyset) PushBack

func (k *Keyset) PushBack(str string) error

func (*Keyset) PushBackWithWeight

func (k *Keyset) PushBackWithWeight(str string, weight float32) error

type LookupCallback

type LookupCallback func(id uint64, key string) error

type NodeOrder

type NodeOrder int

type TailMode

type TailMode int

type Trie

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

func LoadTrieFromFile

func LoadTrieFromFile(file string) (*Trie, error)

func MmapTrie

func MmapTrie(file string) (*Trie, error)

func (*Trie) CommonPrefixSearch

func (t *Trie) CommonPrefixSearch(str string, callback LookupCallback) error

func (*Trie) Dispose

func (t *Trie) Dispose()

func (*Trie) IoSize

func (t *Trie) IoSize() (uint64, error)

func (*Trie) Lookup

func (t *Trie) Lookup(str string) (uint64, error)

func (*Trie) NumKeys

func (t *Trie) NumKeys() (uint64, error)

func (*Trie) NumNodes

func (t *Trie) NumNodes() (uint64, error)

func (*Trie) NumTries

func (t *Trie) NumTries() (uint64, error)

func (*Trie) PredictiveSearch

func (t *Trie) PredictiveSearch(str string, callback LookupCallback) error

func (*Trie) ReverseLookup

func (t *Trie) ReverseLookup(id uint64) (string, error)

func (*Trie) Save

func (t *Trie) Save(file string) error

func (*Trie) Size

func (t *Trie) Size() (uint64, error)

func (*Trie) TotalSize

func (t *Trie) TotalSize() (uint64, error)

Jump to

Keyboard shortcuts

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