namegen

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomRange

func RandomRange(max int64) (int64, error)

RandomRange returns a random integer (using rand.Reader as the entropy source) between 0 and max

Types

type FakeNameGenerator

type FakeNameGenerator struct {
	Prefix string
	Unique bool
}

func (FakeNameGenerator) New

func (fng FakeNameGenerator) New() (string, error)

type NameGenerator

type NameGenerator interface {
	New() (string, error)
}

NameGenerator describes an object capable of generating new environment names

type WordnetNameGenerator

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

WordnetNameGenerator generates names from WordNet data

func NewWordnetNameGenerator

func NewWordnetNameGenerator(filename string, logger *log.Logger) (*WordnetNameGenerator, error)

NewWordnetNameGenerator loads filename (must be a gzip & JSON-encoded wordset list) and returns a WordnetNameGenerator

func (*WordnetNameGenerator) New

func (wng *WordnetNameGenerator) New() (string, error)

New returns a randomly-generated name of the form {adjective}-{noun}

type Wordset

type Wordset struct {
	Adjective []string `json:"adjective"`
	Noun      []string `json:"noun"`
}

Wordset contains synsets for POS taken from WordNet

Jump to

Keyboard shortcuts

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