Reference

Class

RiTa

Name

randomWord

Description Returns a random word from the lexicon that matches the specified criteria (length, syllable-count, phoneme pattern, stress pattern, part-of-speech, etc.).
Example
// a random word from the lexicon
RiTa.randomWord();

// a random plural noun from the lexicon
RiTa.randomWord({ pos: "nns"});

// a random word with 3 syllables and length 3 or 4
RiTa.randomWord({ numSyllables: 3, maxLength: 4});
Parameters
String or Regex (JS), String or Pattern (Java)(optional) regex for the return result to match
Object
(or Map in Java)
options (optional)

{int} options.minLength:
minimum number of characters in target word (default=4)

{int} options.maxLength:
maximum number of characters in target word

{int} options.numSyllables:
target # of syllables in the word

{int} options.limit:
maximum # of results to return (default=10)

{String} options.type:
use "stresses" to indicate that the regex is for matching stress patterns
use "phones" to indicate that the regex is for matching phonemes

{String} options.pos:
the target part-of-speech for the word
either from the Penn tag set or the simplified tag set [a, r, v, n]

Returns
Stringthe random word
Syntax
RiTa.randomWord()
RiTa.randomWord(opts);

Platform Java / JavaScript