words

package
v0.0.0-...-8cf023a Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeLatin1

func NormalizeLatin1(word string) string

NormalizeLatin1 lowercases, replaces codepoints beyond 255 with a space.

Types

type Countdown

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

Countdown represents a dictionary of words of some minimum and maximum length, and partitioned by length.

func NewCountdown

func NewCountdown(minlen int, maxlen int) *Countdown

NewCountdown creates a new Countdown search object.

func (*Countdown) AddDictionary

func (cd *Countdown) AddDictionary(r io.Reader) (int, error)

AddDictionary adds words from a dictionary (io.Reader interface) to the database.

func (*Countdown) AddDictionaryFile

func (cd *Countdown) AddDictionaryFile(filename string) (int, error)

AddDictionaryFile adds lines from a file to the database.

func (*Countdown) FindWords

func (cd *Countdown) FindWords(s string, limit int, maxdist int) FindWordsResult

FindWords searches for the longest words possible.

type CountdownSearchEntry

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

CountdownSearchEntry represents a single word.

func NewCountdownSearchEntry

func NewCountdownSearchEntry(word string) CountdownSearchEntry

NewCountdownSearchEntry takes a word and generates a search-entry from it.

type CountdownWords

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

CountdownWords represents a set of search words of the same length.

func NewCountdownWords

func NewCountdownWords() CountdownWords

NewCountdownWords creates a new Countdown words database

func (*CountdownWords) Add

func (cdw *CountdownWords) Add(se CountdownSearchEntry)

Add a search entry to the database.

type FindWordsResult

type FindWordsResult struct {
	Query string
	Words []WordDistResult

	NumChecked   int
	NumHits      int
	NumFalseBits int
	NumInvalid   int
	NumDistFail  int
}

FindWordsResult is a result-set returned by FindWords

func NewFindWordsResult

func NewFindWordsResult(capacity int) FindWordsResult

NewFindWordsResult creates and initializes a new result-set

func (*FindWordsResult) Sort

func (result *FindWordsResult) Sort() []WordDistResult

Sort on word distance and sub-sort on word length

type WordDistResult

type WordDistResult struct {
	Word string
	Dist int
}

WordDistResult represents words and their distance to the sought word.

Jump to

Keyboard shortcuts

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