acrostic

package module
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: MIT Imports: 4 Imported by: 1

README

Acrostic

A Go (golang) library that returns an acrostical phrase for a given word.

Initially, the library will return a series of adjectives followed by a single noun for the given acrostic. However, the intention is to extend this library to flexibly return adjectives and/or nouns at the consumer's discretion.

Consider this library alpha quality. There is more work to do and not much of my time to do it. With that said, all pull requests are welcome.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBlankAcrostic = errors.New("acrostic may not be blank")

ErrBlankAcrostic is returned when a given acrostic has a length of zero characters.

View Source
var ErrInvalidNumber = errors.New("number of returned acrostics less than 1 is not valid")

ErrInvalidNumber is returned when the number of requested acrostics is less than 1.

View Source
var ErrUninitialized = errors.New("acrostic object has not been initialized")

ErrUninitialized is returned when acrostics are requested from an uninitalized Acrostic object.

Functions

This section is empty.

Types

type Acrostic

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

Acrostic maintains a list of adjectives and nouns, and returns an acrostical phrase for a given word.

func NewAcrostic

func NewAcrostic(adjs, nouns *words.Words) (*Acrostic, error)

NewAcrostic accepts pointers to an adjective and noun word lists, and returns a pointer to a populated Acrostic object.

If the adjectives word list pointer is nil, the default adjectives word list will be used. Likewise for the nouns word list pointer.

func (*Acrostic) GenerateAcrostics

func (a *Acrostic) GenerateAcrostics(acro string, num int) ([]string, error)

GenerateAcrostics accepts an integer indicating the number of phrases to return, and returns a string slice with the results.

func (*Acrostic) GenerateRandomAcrostics

func (a *Acrostic) GenerateRandomAcrostics(length, num int) ([]string, error)

GenerateRandomAcrostics accepts an acrostic length and an integer indicating the number of acrostics to return.

func (*Acrostic) GenerateRandomPhrases

func (a *Acrostic) GenerateRandomPhrases(words, num int) ([]string, error)

GenerateRandomPhrases accepts two integers: words per phrase, and number of phrases. It returns a string slice matching the number of phrases.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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