t9

package
v0.0.0-...-cdb2ca0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2023 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package t9 provides tools for looking up words that match particular digits based on the T9 algorithm.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDigits

func CheckDigits(digits string) error

CheckDigits validates the designated digits and returns an error, if any.

Types

type T9

type T9 interface {
	// Inserts a dictionary word into t9 lookup structure.
	InsertWord(word string) error

	// Retrieves any number of dictionary words from t9 lookup structure based on
	// prefix match or exact match, depending on `exact`.
	GetWords(digits string, exact bool) ([]string, error)
}

T9 interface enables insertion of any dictionary word and then retrieval based on a prefix or exact-only match of t9 digits.

func New

func New() T9

New instantiates a new T9 structure.

func NewCachingT9

func NewCachingT9(cacheSize int) (T9, error)

NewCachingT9 instantiates a new T9 structure that caches lookup results using an LRU cache of the designated maximum size.

Jump to

Keyboard shortcuts

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