halfmatthalfcat / scala-moniker   0.0.1

MIT License GitHub

Generate random monikers in Scala

Scala versions: 2.13 2.12

scala-moniker

Generate random monikers, or nicknames, in Scala.

Support

Version Supported Scala Versions
0.0.1 2.13.x, 2.12.x

Installation

Maven Central

SBT

"com.github.halfmatthalfcat" %% "scala-moniker" % "0.0.1"

Usage

Generate a single, random moniker

import com.github.halfmatthalfcat.moniker._

val moniker: Moniker = Moniker()

val nickname: String = moniker.getRandom()
// weathered store

Generate multiple monikers

import com.github.halfmatthalfcat.moniker._

val moniker: Moniker = Moniker()

val nicknames: Seq[String] = moniker.getRandoms(count = 5)
// List(coal kilometer, level rice, cobalt library, crunchy hub, new tangent)

Change the delimiter

import com.github.halfmatthalfcat.moniker._

val moniker: Moniker = Moniker()

val nickname: String = moniker.getRandom(delimiter = "-")
// crabby-liner

Generate using custom lists

You can specify which lists you want to generate from when instantiating a new instance of Moniker.

import com.github.halfmatthalfcat.moniker._

val moniker: Moniker = Moniker(
  adjectives = Seq(
    Adjective.Appearance,
    Adjective.Colors,
  ),
  nouns = Seq(
    Noun.Astronomy,
    Noun.Containers,
  ) 
)

Word Lists

The word lists are based on the upstream repository imsky/wordlists and are synced periodically. Any request for more words should be asked/added there.