Skip to content
maloquaciousPublic

About

Go package that generates names in invented languages; a port of Martin O'Leary's language.js.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

lango

Go package github.com/maloquacious/lango: generates names in invented languages. A port of Martin O'Leary's language.js. The package documentation (go doc -all github.com/maloquacious/lango) is the specification: the algorithm, every Spec field with its default, the errors, and where the port departs from the source.

rng := rand.New(rand.NewPCG(1, 1))
lang, err := lango.New(lango.RandomSpec(rng), rng)
if err != nil {
	return err
}
name, err := lang.Name("city")

Six names from seed 1, keys city ×3 then river ×3 (from Example in example_test.go):

city Ushtaz
city Niz Míshkázh
city Kázhízh
river Kázkízhás
river Sizashmízh
river Ash Mís

Output is deterministic: the same Spec, the same random stream, and the same sequence of calls give the same names. All randomness comes from the *rand.Rand passed to New and RandomSpec. Each call advances that stream and grows the language's morpheme and word pools, so changing the order of calls changes every later name. A Language made with New is not safe for concurrent use; one made with NewSync is, but then which goroutine gets which name depends on scheduling. Output does not match language.js for any seed.

Stability: until v1.0.0, a minor release may change the names a given seed produces; a patch release will not. If you store seeds, pin the module version.

Checks: go vet ./... and go test ./....

Licence: MIT; see LICENSE.

About

Go package that generates names in invented languages; a port of Martin O'Leary's language.js.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages