Reference

Class

RiTa

Name

randomWord

Description Returns a random word from the lexicon according to specified options
Example
// a random word from the lexicon
RiTa.randomWord();

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

// a random word with 3 syllables and length 3 or 4
RiTa.randomWord({ numSyllables: 3, maxLength: 4});
Parameters
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

{String} options.targetPos:
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);
//in Java you can also do below
//which allow you to set options without Map
RiTa.randomWord(syllables);
RiTa.randomWord(pos);
RiTa.randomWord(pos, syllables);
Platform Java / JavaScript