random_words v1.1.0 RandomWords
Provide a random word from a list of 5,000 most common American English words. Provide options for multiple words at once and words of a particular part-of-speech.
Word list owned and provided by https://www.wordfrequency.info/. Their terms are that this list cannot be reproduced without crediting them by URL.
Link to this section Summary
Functions
Returns a word of type adjective. Note: this excludes determiners, numerals, and adjuncts.
While technically part of the adjective family, they are specific cases. See wordlist/1
for any_adjective
.
Returns a word of type adjunct
Returns a word of type adverb. Note: this excludes conjunctive_adverbs.
While technically part of the adverb family, they are specific cases. See wordlist/1
for any_adverb
.
Returns a word of type conjunctive_adverb
Returns a word of type determiner
Returns a word of type interjection
Returns a word of type noun
Returns a word of type numeral
Returns a word of type preposition
Returns a word of type pronoun
Returns a word of type verb
Examples
# Seed random generation for examples
iex> :rand.seed(:exs1024, {123, 123534, 345345})
iex> RandomWords.word()
"include"
Returns all the words available in any / the specified category.
Examples
# Seed random generation for examples
iex> :rand.seed(:exs1024, {123, 123534, 345345})
iex> RandomWords.words(3)
["gene", "peasant", "candidate"]
Link to this section Types
opts()
Specs
opts() :: [{:part_of_speech, part_of_speech_options()}]
part_of_speech()
Specs
part_of_speech() :: :adjective | :adjunct | :adverb | :conjunctive_adverb | :determiner | :interjection | :noun | :numeral | :preposition | :pronoun | :verb
part_of_speech_options()
Specs
part_of_speech_options() :: :any | :any_adverb | :any_adjective | part_of_speech()
Link to this section Functions
adjective()
Specs
adjective() :: String.t()
Returns a word of type adjective. Note: this excludes determiners, numerals, and adjuncts.
While technically part of the adjective family, they are specific cases. See wordlist/1
for any_adjective
.
adjunct()
Specs
adjunct() :: String.t()
Returns a word of type adjunct
adverb()
Specs
adverb() :: String.t()
Returns a word of type adverb. Note: this excludes conjunctive_adverbs.
While technically part of the adverb family, they are specific cases. See wordlist/1
for any_adverb
.
conjunctive_adverb()
Specs
conjunctive_adverb() :: String.t()
Returns a word of type conjunctive_adverb
determiner()
Specs
determiner() :: String.t()
Returns a word of type determiner
interjection()
Specs
interjection() :: String.t()
Returns a word of type interjection
noun()
Specs
noun() :: String.t()
Returns a word of type noun
numeral()
Specs
numeral() :: String.t()
Returns a word of type numeral
preposition()
Specs
preposition() :: String.t()
Returns a word of type preposition
pronoun()
Specs
pronoun() :: String.t()
Returns a word of type pronoun
verb()
Specs
verb() :: String.t()
Returns a word of type verb
word(opts \\ [part_of_speech: :any])
Specs
Examples
# Seed random generation for examples
iex> :rand.seed(:exs1024, {123, 123534, 345345})
iex> RandomWords.word()
"include"
wordlist(opts \\ [part_of_speech: :any])
Specs
Returns all the words available in any / the specified category.
Note that the :any_adjective
part-of-speech option includes the
determiners, numerals, and adjuncts that are part of the broader
adjective family.
Note that the :any_adverb
part-of-speech option includes the
conjunctive adverbs that are part of the broader adverb family.
Examples
iex> RandomWords.wordlist() |> length()
4995
iex> RandomWords.wordlist(part_of_speech: :verb) |> length()
1001
words(count, opts \\ [part_of_speech: :any])
Specs
words(non_neg_integer(), opts()) :: [String.t()]
Examples
# Seed random generation for examples
iex> :rand.seed(:exs1024, {123, 123534, 345345})
iex> RandomWords.words(3)
["gene", "peasant", "candidate"]