trie

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RuneTrie

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

RuneTrie is a structure for searching strings (tokens)

func New

func New(ignoreCase bool, ignore []rune) *RuneTrie

New creates a new RuneTrie

func (*RuneTrie) Add

func (t *RuneTrie) Add(tokens []*jargon.Token, canonical string)

Add adds tokens and their canonicals to the trie

func (*RuneTrie) SearchCanonical

func (t *RuneTrie) SearchCanonical(tokens ...*jargon.Token) (found bool, canonical string, consumed int)

SearchCanonical walks the trie to find a canonical matching the tokens, preferring longer (greedy) matches, i.e. 'ruby on rails' vs 'ruby'

func (*RuneTrie) String

func (t *RuneTrie) String() string

String returns a representation of the trie as a Go source declaration. It can be large, use sparingly.

Jump to

Keyboard shortcuts

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