Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
func NewGenerator ¶
func (*Generator) Next ¶
Next generates a word. It returns the generated word in all lowercase as string, and an empty word denotes the end of the generation.
func (*Generator) Reset ¶
func (g *Generator) Reset()
Reset restores the initial state and makes the generator to start over at word 1.
func (*Generator) SetCharacters ¶
SetCharacters changes the default character set of available chars.
type Pronounceable ¶
type Pronounceable struct {
// contains filtered or unexported fields
}
func NewPronounceable ¶
func NewPronounceable() *Pronounceable
func (*Pronounceable) AddWord ¶
func (p *Pronounceable) AddWord(word string)
AddWord records n-grams of the given word.
func (*Pronounceable) AddWordList ¶
func (p *Pronounceable) AddWordList(reader io.Reader)
AddWordList takes a reader and scans it word by word, recording their n-grams.
func (*Pronounceable) IsPronounceable ¶
func (p *Pronounceable) IsPronounceable(word string, threshold float64) bool
IsPronounceable determines whether a word is pronounceable by comparing the word score to the given threshold.
func (*Pronounceable) SetWeights ¶
func (p *Pronounceable) SetWeights(uni, bi, tri float64)
SetWeights updates the weight distribution of the n-grams. Defaults are 1 (uni), 3 (bi), 5 (tri).
func (*Pronounceable) WordScore ¶
func (p *Pronounceable) WordScore(word string) float64
WordScore calculates a score that attempts to express how easy it is to pronounce the word.