Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alphabet ¶
type Alphabet string
An Alphabet represents the set of character allowed in a word.
func NewAlphabet ¶
NewAlphabet creates an alphabet from the given slice of characters.
type Checker ¶
type Checker interface { // IsMisspelled returns false if the word is classified as misspelled. // If misspelled, suggested words may be nil or a slice with len > 0. IsMisspelled(word string, dict Dict) (res bool, suggested []string) }
A Checker classifies misspelled words.
type DeltaChecker ¶
A DeltaChecker classifies a word as misspelled if its length is >= MinLength and is within a given number of character deletions, inserts, and consecutive swaps.
func (DeltaChecker) IsMisspelled ¶
func (c DeltaChecker) IsMisspelled(word string, dict Dict) (bool, []string)
type Dict ¶
type Dict interface { // Contains returns true iff the dictionary contains the word Contains(word []rune) bool // Alphabet returns the alphabet of the dictionary's language Alphabet() Alphabet }
A Dict represents a dictionary of words.
type MinLengthChecker ¶
type MinLengthChecker uint8
A MinLengthChecker classifies a word as misspelled iff the length of the word is greater than a given value.
func (MinLengthChecker) IsMisspelled ¶
func (c MinLengthChecker) IsMisspelled(word string, dict Dict) (bool, []string)
type StrictChecker ¶
type StrictChecker struct{}
A StrictChecker classifies a word as misspelled if it does not exist in the dictionary provided.
func (StrictChecker) IsMisspelled ¶
func (StrictChecker) IsMisspelled(word string, dict Dict) (bool, []string)
Click to show internal directories.
Click to hide internal directories.