public static class FakeLanguageGen.SentenceForm
extends java.lang.Object
implements java.io.Serializable
FakeLanguageGen.sentence(IRNG, int, int, String[], String[], double, int)
or one of its overloads.
You can call sentence()
on this to produce another String sentence with the parameters it was given
at construction. The parameters to
SentenceForm(FakeLanguageGen, IStatefulRNG, int, int, String[], String[], double, int)
are stored in fields of
the same name, and all fields in this class are public and modifiable.Modifier and Type | Field and Description |
---|---|
java.lang.String[] |
endPunctuation |
FakeLanguageGen |
language |
int |
maxChars |
int |
maxWords |
java.lang.String[] |
midPunctuation |
double |
midPunctuationFrequency |
int |
minWords |
IStatefulRNG |
rng |
Constructor and Description |
---|
SentenceForm()
Builds a SentenceForm with all default fields, using
FakeLanguageGen.FANTASY_NAME for a language,
using between 1 and 9 words in a sentence, and otherwise defaulting to how
SentenceForm(FakeLanguageGen, int, int) behaves. |
SentenceForm(FakeLanguageGen language,
int minWords,
int maxWords)
Builds a SentenceForm with only a few fields specified.
|
SentenceForm(FakeLanguageGen language,
int minWords,
int maxWords,
java.lang.String[] midPunctuation,
java.lang.String[] endPunctuation,
double midPunctuationFrequency)
Builds a SentenceForm with all fields specified except for
rng , which will be made based on
FakeLanguageGen's static FakeLanguageGen.srng field, and maxChars, which means the sentence length
will be limited only by maxWords and the length of words produced. |
SentenceForm(FakeLanguageGen language,
int minWords,
int maxWords,
java.lang.String[] midPunctuation,
java.lang.String[] endPunctuation,
double midPunctuationFrequency,
int maxChars)
Builds a SentenceForm with all fields specified except for
rng , which will be made based on
FakeLanguageGen's static FakeLanguageGen.srng field. |
SentenceForm(FakeLanguageGen language,
IStatefulRNG rng,
int minWords,
int maxWords,
java.lang.String[] midPunctuation,
java.lang.String[] endPunctuation,
double midPunctuationFrequency,
int maxChars)
Builds a SentenceForm with all fields specified; each value is referenced directly except for
rng ,
which will not change or be directly referenced (a new GWTRNG will be used with the same state value). |
Modifier and Type | Method and Description |
---|---|
static FakeLanguageGen.SentenceForm |
deserializeFromString(java.lang.String ser) |
java.lang.String |
sentence() |
java.lang.String |
serializeToString() |
public IStatefulRNG rng
public int minWords
public int maxWords
public int maxChars
public java.lang.String[] midPunctuation
public java.lang.String[] endPunctuation
public double midPunctuationFrequency
public FakeLanguageGen language
public SentenceForm()
FakeLanguageGen.FANTASY_NAME
for a language,
using between 1 and 9 words in a sentence, and otherwise defaulting to how
SentenceForm(FakeLanguageGen, int, int)
behaves.public SentenceForm(FakeLanguageGen language, int minWords, int maxWords)
rng
will be made based on
FakeLanguageGen's static FakeLanguageGen.srng
field, maxChars will be -1 so the sentence length
will be limited only by maxWords and the length of words produced, and the between-word and end-of-sentence
punctuation will be set to reasonable defaults. This places either a comma or a semicolon after a word in the
middle of a sentence about 18% of the time (midPunctuationFrequency
is 0.18), and can end a sentence
in a period, exclamation mark, question mark, or ellipsis (the "..." punctuation).language
- A FakeLanguageGen to use to generate wordsminWords
- minimum words per sentencemaxWords
- maximum words per sentencepublic SentenceForm(FakeLanguageGen language, int minWords, int maxWords, java.lang.String[] midPunctuation, java.lang.String[] endPunctuation, double midPunctuationFrequency)
rng
, which will be made based on
FakeLanguageGen's static FakeLanguageGen.srng
field, and maxChars, which means the sentence length
will be limited only by maxWords and the length of words produced.language
- A FakeLanguageGen to use to generate wordsminWords
- minimum words per sentencemaxWords
- maximum words per sentencemidPunctuation
- an array of Strings that can be used immediately after words in the middle of sentences, like "," or ";"endPunctuation
- an array of Strings that can end a sentence, like ".", "?", or "..."midPunctuationFrequency
- the probability that two words will be separated by a String from midPunctuation, between 0.0 and 1.0public SentenceForm(FakeLanguageGen language, int minWords, int maxWords, java.lang.String[] midPunctuation, java.lang.String[] endPunctuation, double midPunctuationFrequency, int maxChars)
rng
, which will be made based on
FakeLanguageGen's static FakeLanguageGen.srng
field.language
- A FakeLanguageGen to use to generate wordsminWords
- minimum words per sentencemaxWords
- maximum words per sentencemidPunctuation
- an array of Strings that can be used immediately after words in the middle of sentences, like "," or ";"endPunctuation
- an array of Strings that can end a sentence, like ".", "?", or "..."midPunctuationFrequency
- the probability that two words will be separated by a String from midPunctuation, between 0.0 and 1.0maxChars
- the maximum number of chars to use in a sentence, or -1 for no hard limitpublic SentenceForm(FakeLanguageGen language, IStatefulRNG rng, int minWords, int maxWords, java.lang.String[] midPunctuation, java.lang.String[] endPunctuation, double midPunctuationFrequency, int maxChars)
rng
,
which will not change or be directly referenced (a new GWTRNG will be used with the same state value).language
- A FakeLanguageGen to use to generate wordsrng
- a StatefulRNG that will not be directly referenced; the state will be copied into a new StatefulRNGminWords
- minimum words per sentencemaxWords
- maximum words per sentencemidPunctuation
- an array of Strings that can be used immediately after words in the middle of sentences, like "," or ";"endPunctuation
- an array of Strings that can end a sentence, like ".", "?", or "..."midPunctuationFrequency
- the probability that two words will be separated by a String from midPunctuation, between 0.0 and 1.0maxChars
- the maximum number of chars to use in a sentence, or -1 for no hard limitpublic java.lang.String sentence()
public java.lang.String serializeToString()
public static FakeLanguageGen.SentenceForm deserializeFromString(java.lang.String ser)
Copyright © Eben Howard 2012–2022. All rights reserved.