names

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: MPL-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompoundNamer added in v1.5.0

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

CompoundNamer provides a name generator that combines multiple other name generators.

func NewCompoundNamer added in v1.5.0

func NewCompoundNamer(separator string, lowered, firstToUpper bool, namers ...Namer) *CompoundNamer

NewCompoundNamer creates a new CompoundNamer. The 'separator' will be placed between each name generated by the 'namers'. If 'lowered' is true, then the result will be forced to lowercase. If 'firstToUpper' is true, then the result will have its first letter capitalized.

func (*CompoundNamer) GenerateName added in v1.5.0

func (n *CompoundNamer) GenerateName() string

GenerateName generates a new random name.

func (*CompoundNamer) GenerateNameWithRandomizer added in v1.5.0

func (n *CompoundNamer) GenerateNameWithRandomizer(rnd rand.Randomizer) string

GenerateNameWithRandomizer generates a new random name using the specified randomizer.

type MarkovLetterNamer added in v1.5.0

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

MarkovLetterNamer provides a name generator that creates a name based on markov chains of individual letter sequences.

func NewMarkovLetterNamer added in v1.5.0

func NewMarkovLetterNamer(depth int, data map[string]int, lowered, firstToUpper bool) *MarkovLetterNamer

NewMarkovLetterNamer creates a new MarkovLetterNamer. The depth is the number of letters to consider within a run at a time. The data should be a map of names to a count which indicates how common the name is relative to others in the set. Any count less than 1 effectively removes the name from the set. If 'lowered' is true, then the result will be forced to lowercase. If 'firstToUpper' is true, then the result will have its first letter capitalized.

func NewMarkovLetterUnweightedNamer added in v1.5.0

func NewMarkovLetterUnweightedNamer(depth int, data []string, lowered, firstToUpper bool) *MarkovLetterNamer

NewMarkovLetterUnweightedNamer creates a new MarkovLetterNamer. The depth is the number of letters to consider within a run at a time. The data should be a set of names to train the model with. If 'lowered' is true, then the result will be forced to lowercase. If 'firstToUpper' is true, then the result will have its first letter capitalized.

func (*MarkovLetterNamer) GenerateName added in v1.5.0

func (n *MarkovLetterNamer) GenerateName() string

GenerateName generates a new random name.

func (*MarkovLetterNamer) GenerateNameWithRandomizer added in v1.5.0

func (n *MarkovLetterNamer) GenerateNameWithRandomizer(rnd rand.Randomizer) string

GenerateNameWithRandomizer generates a new random name using the specified randomizer.

type MarkovRunNamer added in v1.5.0

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

MarkovRunNamer provides a name generator that creates a name based on markov chains of runs of vowels or consonants.

func NewMarkovRunNamer added in v1.5.0

func NewMarkovRunNamer(data map[string]int, lowered, firstToUpper bool) *MarkovRunNamer

NewMarkovRunNamer creates a new MarkovRunNamer. The data should be a map of names to a count which indicates how common the name is relative to others in the set. Any count less than 1 effectively removes the name from the set. If 'lowered' is true, then the result will be forced to lowercase. If 'firstToUpper' is true, then the result will have its first letter capitalized.

func NewMarkovRunUnweightedNamer added in v1.5.0

func NewMarkovRunUnweightedNamer(data []string, lowered, firstToUpper bool) *MarkovRunNamer

NewMarkovRunUnweightedNamer creates a new MarkovRunNamer. The data should be a set of names to train the model with. If 'lowered' is true, then the result will be forced to lowercase. If 'firstToUpper' is true, then the result will have its first letter capitalized.

func (*MarkovRunNamer) GenerateName added in v1.5.0

func (n *MarkovRunNamer) GenerateName() string

GenerateName generates a new random name.

func (*MarkovRunNamer) GenerateNameWithRandomizer added in v1.5.0

func (n *MarkovRunNamer) GenerateNameWithRandomizer(rnd rand.Randomizer) string

GenerateNameWithRandomizer generates a new random name using the specified randomizer.

type Namer added in v1.5.0

type Namer interface {
	// GenerateName generates a new random name.
	GenerateName() string
	// GenerateNameWithRandomizer generates a new random name using the specified randomizer.
	GenerateNameWithRandomizer(rnd rand.Randomizer) string
}

Namer defines the methods required of a name generator.

type SimpleNamer added in v1.5.0

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

SimpleNamer provides a name generator that selects a name from the weighted set of names provided to it.

func NewSimpleNamer added in v1.5.0

func NewSimpleNamer(data map[string]int, lowered, firstToUpper bool) *SimpleNamer

NewSimpleNamer creates a new SimpleNamer. The data should be a map of names to a count which indicates how common the name is relative to others in the set. Any count less than 1 effectively removes the name from the set. If 'lowered' is true, then the result will be forced to lowercase. If 'firstToUpper' is true, then the result will have its first letter capitalized.

func NewSimpleUnweightedNamer added in v1.5.0

func NewSimpleUnweightedNamer(data []string, lowered, firstToUpper bool) *SimpleNamer

NewSimpleUnweightedNamer creates a new SimpleNamer. The data should be a set of names to choose from. If 'lowered' is true, then the result will be forced to lowercase. If 'firstToUpper' is true, then the result will have its first letter capitalized.

func (*SimpleNamer) GenerateName added in v1.5.0

func (n *SimpleNamer) GenerateName() string

GenerateName generates a new random name.

func (*SimpleNamer) GenerateNameWithRandomizer added in v1.5.0

func (n *SimpleNamer) GenerateNameWithRandomizer(rnd rand.Randomizer) string

GenerateNameWithRandomizer generates a new random name using the specified randomizer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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