dict

package
v0.0.0-...-4750911 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: ISC Imports: 4 Imported by: 0

Documentation

Overview

Package dict maintains stuff relevant to wordlists of different languages.

Code generated by sammyne. DO NOT EDIT.

Code generated by sammyne. DO NOT EDIT.

Index

Constants

View Source
const (
	Reserved = Language(iota)
	ChineseSimpilified
	ChineseTraditional
	English
	French
	Italian
	Japanese
	Korean
	Spanish
)

enumerations of different languages as named

View Source
const (
	// IdeographicSpaces is the whitespace used specifically for Japanese
	IdeographicSpaces = "\u3000"
	// ASCIISpace is the default whitespace employed for languages except above
	ASCIISpace = " "
)

spaces enumerations

Variables

View Source
var (
	// ErrDisabledTrie signals trie for a given language has been disabled
	ErrDisabledTrie = errors.New("trie is disabled")
	// ErrOccupiedLanguage has been registered somewhere else
	ErrOccupiedLanguage = errors.New("language already occupied")
	// ErrUnknownLanguage signals a language as a parameter isn't registered
	ErrUnknownLanguage = errors.New("the provided language isn't registered")
)

errors enumerations

Functions

func Disable

func Disable(lang Language)

Disable clean up the trie bound to the given language

func Enable

func Enable(lang Language) error

Enable constructs the trie based on the wordlist bound to the given language

func LookUp

func LookUp(trie *trie.Trie, word string) (int, bool)

LookUp searchs a given word against the given trie, and return the index (stored in its meta) of the word.

func Register

func Register(lang Language, generator WordlistGenerator,
	description string) error

Register takes into record a given language, its wordlist generator and a brief description

func UseLanguage

func UseLanguage(lang Language) error

UseLanguage overrides the global default language to use.

func Whitespace

func Whitespace(lang Language) string

Whitespace finds the whitespace for the given language

Types

type Language

type Language int

Language denotes the type of languages

func TrieToUse

func TrieToUse(lang ...Language) (*trie.Trie, Language, error)

TrieToUse gets the trie bound to the given language if any. If no language provided, the global default will be employed. Both the trie and language bound to it (is the global default language if no language is provided) will be returned

func WordlistToUse

func WordlistToUse(lang ...Language) ([]string, Language, error)

WordlistToUse returns the wordlist bound to a language, which is the provided one if any, otherwise the global default language. The 2nd output is the language bound to the wordlist (the 1st output) in case of no error.

func (Language) String

func (lang Language) String() string

String returns the description bound to the language if registered, and empty string otherwise.

type WordlistGenerator

type WordlistGenerator func() []string

WordlistGenerator is the signature of function generating a wordlist

Jump to

Keyboard shortcuts

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