public class MarkovChainLanguageModel extends Object
| Constructor and Description |
|---|
MarkovChainLanguageModel()
Generate a new empty markov chain language model
|
| Modifier and Type | Method and Description |
|---|---|
String |
generate(Locale language,
int length,
String encoding)
Generate a string using this model of the desired length
|
void |
train(Locale language,
InputStream stream)
Train a given language on a stream of text
|
void |
train(Locale language,
String example,
String encoding)
Add an example to a language's markov chain
|
public MarkovChainLanguageModel()
public void train(Locale language, String example, String encoding) throws UnsupportedEncodingException
language - the language the example is being added toexample - the new example to learn fromencoding - the encoding of the exampleUnsupportedEncodingExceptionpublic void train(Locale language, InputStream stream) throws IOException
language - stream - IOExceptionpublic String generate(Locale language, int length, String encoding) throws UnsupportedEncodingException
language - length - encoding - UnsupportedEncodingException