Package squidpony

Class FakeLanguageGen.SentenceForm

java.lang.Object
squidpony.FakeLanguageGen.SentenceForm
All Implemented Interfaces:
Serializable
Enclosing class:
FakeLanguageGen

public static class FakeLanguageGen.SentenceForm
extends Object
implements Serializable
A simple way to bundle a FakeLanguageGen with the arguments that would be passed to it when calling 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.
See Also:
Serialized Form
  • Field Details

  • Constructor Details

    • SentenceForm

      public 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

      public SentenceForm​(FakeLanguageGen language, int minWords, int maxWords)
      Builds a SentenceForm with only a few fields specified. The 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).
      Parameters:
      language - A FakeLanguageGen to use to generate words
      minWords - minimum words per sentence
      maxWords - maximum words per sentence
    • SentenceForm

      public SentenceForm​(FakeLanguageGen language, int minWords, int maxWords, String[] midPunctuation, 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.
      Parameters:
      language - A FakeLanguageGen to use to generate words
      minWords - minimum words per sentence
      maxWords - maximum words per sentence
      midPunctuation - 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.0
    • SentenceForm

      public SentenceForm​(FakeLanguageGen language, int minWords, int maxWords, String[] midPunctuation, 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.
      Parameters:
      language - A FakeLanguageGen to use to generate words
      minWords - minimum words per sentence
      maxWords - maximum words per sentence
      midPunctuation - 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.0
      maxChars - the maximum number of chars to use in a sentence, or -1 for no hard limit
    • SentenceForm

      public SentenceForm​(FakeLanguageGen language, IStatefulRNG rng, int minWords, int maxWords, String[] midPunctuation, 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).
      Parameters:
      language - A FakeLanguageGen to use to generate words
      rng - a StatefulRNG that will not be directly referenced; the state will be copied into a new StatefulRNG
      minWords - minimum words per sentence
      maxWords - maximum words per sentence
      midPunctuation - 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.0
      maxChars - the maximum number of chars to use in a sentence, or -1 for no hard limit
  • Method Details