RiMarkov

Description

Performs text generation via Markov chains (aka n-grams) with options to process single characters, words, sentences, or arbitrary regular expressions.

Provides a variety of methods specifically designed for text-generation.

Examples
rm = new RiMarkov(3);

rm.loadText(theText);

sentences = rm.generateSentences(10);

for (i = 0; i < sentences.length; i++) {
  println(sentences[i]);
}
Syntax
// Constructs a sentence-generating Markov-chain and set its n-factor.

RiMarkov(nFactor)

// Also sets a flag determining whether the model will attempt to recognize
// and parse (English) sentences (default=true)

RiMarkov( nFactor, recognizeSentences)

// Also sets a flag to allow duplicates in the generated output (default=true)

RiMarkov(nFactor, recognizeSentences, allowDuplicates)

Parameters
  int nFactor - the length of each n-gram stored in the model
  boolean recognizeSentences - whether the model should treat the input as a series of sentences
  boolean allowDuplicates - whether sequences from the input should be allowed in the output
Platform Java / Javascript