newton

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2019 License: MIT Imports: 8 Imported by: 0

README

newton: a Random Name Generator

Package newton contains elements that can be used for generating a random name (both sound and spelling). See GoDoc for details.

Documentation

Overview

Package newton contains elements that can be used for generating a random name (both sound and spelling).

Consonant sounds supported:

b - as pronounced in Beep
c - as pronounced in miCe
d - as pronounced in Deep
f - as pronounced in Fish
* - as pronounced in Gate
j - as pronounced in Jack
k - as pronounced in Kiss
l - as pronounced in Lime
m - as pronounced in Meat
n - as pronounced in Neat
p - as pronounced in beeP
r - as pronounced in Rise
t - as pronounced in Tise
v - as pronounced in Vase
w - as pronounced in Wine
x - as pronounced in Zeal
y - as pronounced in Yard

Vowel sounds supported:

@ - as pronounced in At
a - as pronounced in Ape
! - as pronounced in Exclaim
e - as pronounced in mEAt
o - as pronounced in pOke
_ - as pronounced in Underscore
# - as pronounced in Ubuntu

Using the info above:

the sound for "Silicon" would be: "selek_n"; the sound for "Apple" would be "@p#l".

Index

Constants

This section is empty.

Variables

View Source
var (
	Sound_TypeCons byte = 0
	Sound_TypeVowl byte = 1
)

Functions

func InitReport

func InitReport() error

Types

type Name

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

func Name_New added in v0.3.0

func Name_New(sound []Sound) Name

func Name_Rand added in v0.3.0

func Name_Rand(pattern string) (name Name, e error)

Function Name_Rand () provides a random name (i.e. a name's sound). Argument should be the desired pattern for the name's sound.

Example:

cevecv
cve

'c' stands for consonant sound; 'v' stands for vowel sound; 'e' stands for either 'c' or 'v'

In other words, pattern 'ecv' can yield 'et@'.

func (*Name) Polish added in v0.3.0

func (n *Name) Polish()

Method Polish () modifies a name such that it becomes easier to pronounce.

func (Name) Spelling added in v0.3.0

func (n Name) Spelling(no int) (o []string, e error)

Method Spelling () provides English spelling for the name. Its argument should be the number of possible spellings you would like.

If there are as much spelling as you requested, you would get that number of spellings. If there are not as much spelling as you requested, all the ones available would be returned.

func (Name) String added in v0.3.0

func (n Name) String() (o string)

type Sound

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

func Sound_New added in v0.3.0

func Sound_New(sound rune) (s Sound, e error)

func Sound_Rand added in v0.3.0

func Sound_Rand(soundType ...rune) (sound Sound, e error)

Function Sound_Rand () provides a random sound. The type of sound you want can be optionally supplied as an argument. For a consonant sound: use 'c' as your argument, and for a vowel sound: use 'v'.

sound, err := Sound_Rand ('c')

If you are not bothered about the sound being consonant or vowel, do not supply any argument.

sound, err := Sound_Rand ()

func (*Sound) String added in v0.3.0

func (s *Sound) String() string

func (*Sound) Type added in v0.3.0

func (s *Sound) Type() byte

Method Type () tells if the sound is a consonant (Sound_TypeCons) or vowel (Sound_TypeCons).

Jump to

Keyboard shortcuts

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