Reference

Class

RiTa

Name

search [async]

Description Searches for words in the lexicon that match the given criteria, either by length, syllable-count, phoneme, stress, part-of-speech, etc. If no regex or options are supplied, the full set of words is returned.

Note: async in JavaScript, use await or .then(). For a synchronous version, use RiTa.searchSync().
Example
RiTa.search();
RiTa.search("tting")
RiTa.search('f-ah-n-t', { type: 'phones', pos: 'n', numSyllables: 2 })
Parameters
String or Regex (JS), String or Pattern (Java)regex pattern to match (optional)
Object
(or Map in Java)
options (optional)

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

{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]

{boolean} options.shuffle:
if true, iterate over lexicon in random order

Returns
String[]array of words matching the search criteria in the lexicon (or all words if no criteria is provided)
Syntax
RiTa.search()
RiTa.search(regex);
RiTa.search(regex, opts);
Platform Java / JavaScript