public class FakeLanguageGen extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
FakeLanguageGen.Alteration |
static class |
FakeLanguageGen.Modifier |
Modifier and Type | Field and Description |
---|---|
static FakeLanguageGen |
ARABIC_ROMANIZED
Imitation Arabic, using mostly the Latin alphabet but with some Greek letters for tough transliteration topics.
|
boolean |
clean |
String[] |
closingConsonants |
String[] |
closingSyllables |
static FakeLanguageGen |
ENGLISH
Imitation English; may seem closer to Dutch in some generated text, and is not exactly the best imitation.
|
static FakeLanguageGen |
FANCY_FANTASY_NAME
A mix of four different languages with some accented characters added onto an ASCII base, that can be good for
generating single words for creature or place names in fantasy settings that should have a "fancy" feeling from
having unnecessary accents added primarily for visual reasons.
|
static FakeLanguageGen |
FANTASY_NAME
A mix of four different languages, using only ASCII characters, that is meant for generating single words for
creature or place names in fantasy settings.
|
static FakeLanguageGen |
FRENCH
Imitation modern French, using (too many of) the accented vowels that are present in the language.
|
static FakeLanguageGen |
GREEK_AUTHENTIC
Imitation ancient Greek, using the original Greek alphabet.
|
static FakeLanguageGen |
GREEK_ROMANIZED
Imitation ancient Greek, romanized to use the Latin alphabet.
|
static FakeLanguageGen |
HINDI_IAST
Imitation Hindi, romanized to use the Latin alphabet using accented glyphs from the IAST standard, which are not
typically printable with many fonts but are more likely to seem like samples of Hindi from, say, Wikipedia.
|
static FakeLanguageGen |
HINDI_ROMANIZED
Imitation Hindi, romanized to use the Latin alphabet using accented glyphs similar to the IAST standard.
|
static FakeLanguageGen |
JAPANESE_ROMANIZED
Imitation Japanese, romanized to use the Latin alphabet.
|
static FakeLanguageGen |
LOVECRAFT
Ia! Ia! Cthulhu Rl'yeh ftaghn! Useful for generating cultist ramblings or unreadable occult texts.
|
String[] |
midConsonants |
String[] |
midVowels |
ArrayList<FakeLanguageGen.Modifier> |
modifiers |
String[] |
openingConsonants |
String[] |
openingVowels |
static FakeLanguageGen |
RUSSIAN_AUTHENTIC
Imitation modern Russian, using the authentic Cyrillic alphabet used in Russia and other countries.
|
static FakeLanguageGen |
RUSSIAN_ROMANIZED
Imitation modern Russian, romanized to use the Latin alphabet.
|
regexodus.Pattern[] |
sanityChecks |
static FakeLanguageGen |
SOMALI
Imitation Somali, using the Latin alphabet.
|
static StatefulRNG |
srng |
static FakeLanguageGen |
SWAHILI
Swahili is one of the more commonly-spoken languages in sub-Saharan Africa, and serves mainly as a shared language
that is often learned after becoming fluent in one of many other (vaguely-similar) languages of the area.
|
double |
syllableEndFrequency |
LinkedHashMap<Integer,Double> |
syllableFrequencies |
protected double |
totalSyllableFrequency |
double |
vowelEndFrequency |
double |
vowelSplitFrequency |
String[] |
vowelSplitters |
double |
vowelStartFrequency |
Constructor and Description |
---|
FakeLanguageGen()
Zero-arg constructor for a FakeLanguageGen; produces a FakeLanguageGen equivalent to FakeLanguageGen.ENGLISH .
|
FakeLanguageGen(String[] openingVowels,
String[] midVowels,
String[] openingConsonants,
String[] midConsonants,
String[] closingConsonants,
String[] closingSyllables,
String[] vowelSplitters,
int[] syllableLengths,
double[] syllableFrequencies,
double vowelStartFrequency,
double vowelEndFrequency,
double vowelSplitFrequency,
double syllableEndFrequency)
This is a very complicated constructor! Maybe look at the calls to this to initialize static members of this
class, LOVECRAFT and GREEK_ROMANIZED.
|
FakeLanguageGen(String[] openingVowels,
String[] midVowels,
String[] openingConsonants,
String[] midConsonants,
String[] closingConsonants,
String[] closingSyllables,
String[] vowelSplitters,
int[] syllableLengths,
double[] syllableFrequencies,
double vowelStartFrequency,
double vowelEndFrequency,
double vowelSplitFrequency,
double syllableEndFrequency,
regexodus.Pattern[] sane,
boolean clean)
This is a very complicated constructor! Maybe look at the calls to this to initialize static members of this
class, LOVECRAFT and GREEK_ROMANIZED.
|
Modifier and Type | Method and Description |
---|---|
protected String[] |
accentBoth(RNG rng,
String[] me,
double vowelInfluence,
double consonantInfluence) |
protected String[] |
accentConsonants(RNG rng,
String[] me,
double influence) |
protected String[] |
accentVowels(RNG rng,
String[] me,
double influence) |
FakeLanguageGen |
addAccents(double vowelInfluence,
double consonantInfluence) |
FakeLanguageGen |
addModifiers(Collection<FakeLanguageGen.Modifier> mods)
Adds the specified Modifier objects from a Collection to a copy of this FakeLanguageGen and returns it.
|
FakeLanguageGen |
addModifiers(FakeLanguageGen.Modifier... mods)
Adds the specified Modifier objects to a copy of this FakeLanguageGen and returns it.
|
protected boolean |
checkAll(CharSequence testing,
regexodus.Pattern[] checks) |
FakeLanguageGen |
copy() |
boolean |
equals(Object o) |
int |
hashCode() |
protected String[] |
merge1000(RNG rng,
String[] me,
String[] other,
double otherInfluence) |
FakeLanguageGen |
mix(FakeLanguageGen other,
double otherInfluence) |
static FakeLanguageGen.Modifier |
modifier(String pattern,
String replacement) |
static FakeLanguageGen.Modifier |
modifier(String pattern,
String replacement,
double chance) |
FakeLanguageGen |
removeAccents() |
CharSequence |
removeAccents(CharSequence str)
Removes accented Latin-script characters from a string; if the "base" characters are non-English anyway then the
result won't be an ASCII string, but otherwise it probably will be.
|
FakeLanguageGen |
removeModifiers()
Creates a copy of this FakeLanguageGen with no modifiers.
|
String |
sentence(int minWords,
int maxWords)
Generate a sentence from this FakeLanguageGen, using and changing the current seed.
|
String |
sentence(int minWords,
int maxWords,
String[] midPunctuation,
String[] endPunctuation,
double midPunctuationFrequency)
Generate a sentence from this FakeLanguageGen, using and changing the current seed.
|
String |
sentence(int minWords,
int maxWords,
String[] midPunctuation,
String[] endPunctuation,
double midPunctuationFrequency,
int maxChars)
Generate a sentence from this FakeLanguageGen that fits in the given length limit..
|
String |
sentence(RNG rng,
int minWords,
int maxWords,
String[] midPunctuation,
String[] endPunctuation,
double midPunctuationFrequency)
Generate a sentence from this FakeLanguageGen using the specific RNG.
|
String |
sentence(RNG rng,
int minWords,
int maxWords,
String[] midPunctuation,
String[] endPunctuation,
double midPunctuationFrequency,
int maxChars)
Generate a sentence from this FakeLanguageGen using the specific RNG that fits in the given length limit.
|
String |
toString() |
String |
word(boolean capitalize)
Generate a word from this FakeLanguageGen, using and changing the current seed.
|
String |
word(RNG rng,
boolean capitalize)
Generate a word from this FakeLanguageGen using the specified RNG.
|
String |
word(RNG rng,
boolean capitalize,
int approxSyllables)
Generate a word from this FakeLanguageGen using the specified RNG.
|
public final String[] openingVowels
public final String[] openingConsonants
public final String[] midConsonants
public final String[] closingConsonants
public final String[] vowelSplitters
public final String[] closingSyllables
public boolean clean
public final LinkedHashMap<Integer,Double> syllableFrequencies
protected double totalSyllableFrequency
public final double vowelStartFrequency
public final double vowelEndFrequency
public final double vowelSplitFrequency
public final double syllableEndFrequency
public final regexodus.Pattern[] sanityChecks
public ArrayList<FakeLanguageGen.Modifier> modifiers
public static final StatefulRNG srng
public static final FakeLanguageGen LOVECRAFT
public static final FakeLanguageGen ENGLISH
public static final FakeLanguageGen GREEK_ROMANIZED
public static final FakeLanguageGen GREEK_AUTHENTIC
public static final FakeLanguageGen FRENCH
public static final FakeLanguageGen RUSSIAN_ROMANIZED
public static final FakeLanguageGen RUSSIAN_AUTHENTIC
public static final FakeLanguageGen JAPANESE_ROMANIZED
public static final FakeLanguageGen SWAHILI
public static final FakeLanguageGen SOMALI
public static final FakeLanguageGen HINDI_ROMANIZED
"ŗŕļĺđţńņşĕĭ"
become "ŗŕļĺđţńņşĕĭ"
, with the nth glyph in the first string being substituted
with the nth glyph in the second string. This version of imitation Hindi is preferred over the IAST kind because
font support is much better for the glyphs this version uses.
public static final FakeLanguageGen HINDI_IAST
"ṛṝḷḹḍṭṅṇṣṃḥ"
to
"ŗŕļĺđţńņşĕĭ"
, with the nth glyph in the first string being substituted with the nth glyph in the second
string. Using HINDI_ROMANIZED is recommended if you use the fonts known by SquidLib's display module.
public static final FakeLanguageGen ARABIC_ROMANIZED
public static final FakeLanguageGen FANTASY_NAME
public static final FakeLanguageGen FANCY_FANTASY_NAME
public FakeLanguageGen()
public FakeLanguageGen(String[] openingVowels, String[] midVowels, String[] openingConsonants, String[] midConsonants, String[] closingConsonants, String[] closingSyllables, String[] vowelSplitters, int[] syllableLengths, double[] syllableFrequencies, double vowelStartFrequency, double vowelEndFrequency, double vowelSplitFrequency, double syllableEndFrequency)
openingVowels
- String array where each element is a vowel or group of vowels that may appear at the start
of a word or in the middle; elements may be repeated to make them more commonmidVowels
- String array where each element is a vowel or group of vowels that may appear in the
middle of the word; all openingVowels are automatically copied into this internally.
Elements may be repeated to make them more commonopeningConsonants
- String array where each element is a consonant or consonant cluster that can appear
at the start of a word; elements may be repeated to make them more commonmidConsonants
- String array where each element is a consonant or consonant cluster than can appear
between vowels; all closingConsonants are automatically copied into this internally.
Elements may be repeated to make them more commonclosingConsonants
- String array where each element is a consonant or consonant cluster than can appear
at the end of a word; elements may be repeated to make them more commonclosingSyllables
- String array where each element is a syllable starting with a vowel and ending in
whatever the word should end in; elements may be repeated to make them more commonvowelSplitters
- String array where each element is a mark that goes between vowels, so if "-" is in this,
then "a-a" may be possible; elements may be repeated to make them more commonsyllableLengths
- int array where each element is a possible number of syllables a word can use; closely
tied to syllableFrequenciessyllableFrequencies
- double array where each element corresponds to an element in syllableLengths and
represents how often each syllable count should appear relative to other counts; there
is no need to restrict the numbers to add up to any other numbervowelStartFrequency
- a double between 0.0 and 1.0 that determines how often words start with vowels;
higher numbers yield more words starting with vowelsvowelEndFrequency
- a double between 0.0 and 1.0 that determines how often words end with vowels; higher
numbers yield more words ending in vowelsvowelSplitFrequency
- a double between 0.0 and 1.0 that, if vowelSplitters is not empty, determines how
often a vowel will be split into two vowels separated by one of those splitterssyllableEndFrequency
- a double between 0.0 and 1.0 that determines how often an element of
closingSyllables is used instead of ending normallypublic FakeLanguageGen(String[] openingVowels, String[] midVowels, String[] openingConsonants, String[] midConsonants, String[] closingConsonants, String[] closingSyllables, String[] vowelSplitters, int[] syllableLengths, double[] syllableFrequencies, double vowelStartFrequency, double vowelEndFrequency, double vowelSplitFrequency, double syllableEndFrequency, regexodus.Pattern[] sane, boolean clean)
openingVowels
- String array where each element is a vowel or group of vowels that may appear at the start
of a word or in the middle; elements may be repeated to make them more commonmidVowels
- String array where each element is a vowel or group of vowels that may appear in the
middle of the word; all openingVowels are automatically copied into this internally.
Elements may be repeated to make them more commonopeningConsonants
- String array where each element is a consonant or consonant cluster that can appear
at the start of a word; elements may be repeated to make them more commonmidConsonants
- String array where each element is a consonant or consonant cluster than can appear
between vowels; all closingConsonants are automatically copied into this internally.
Elements may be repeated to make them more commonclosingConsonants
- String array where each element is a consonant or consonant cluster than can appear
at the end of a word; elements may be repeated to make them more commonclosingSyllables
- String array where each element is a syllable starting with a vowel and ending in
whatever the word should end in; elements may be repeated to make them more commonvowelSplitters
- String array where each element is a mark that goes between vowels, so if "-" is in this,
then "a-a" may be possible; elements may be repeated to make them more commonsyllableLengths
- int array where each element is a possible number of syllables a word can use; closely
tied to syllableFrequenciessyllableFrequencies
- double array where each element corresponds to an element in syllableLengths and
represents how often each syllable count should appear relative to other counts; there
is no need to restrict the numbers to add up to any other numbervowelStartFrequency
- a double between 0.0 and 1.0 that determines how often words start with vowels;
higher numbers yield more words starting with vowelsvowelEndFrequency
- a double between 0.0 and 1.0 that determines how often words end with vowels; higher
numbers yield more words ending in vowelsvowelSplitFrequency
- a double between 0.0 and 1.0 that, if vowelSplitters is not empty, determines how
often a vowel will be split into two vowels separated by one of those splitterssyllableEndFrequency
- a double between 0.0 and 1.0 that determines how often an element of
closingSyllables is used instead of ending normallysane
- true to perform sanity checks for pronounce-able sounds to most English speakers, replacing many
words that are impossible to say; slows down generation slightly, irrelevant for non-Latin alphabetsclean
- true to perform vulgarity/obscenity checks on the word, replacing it if it is too close to a
common English vulgarity, obscenity, or slur/epithet; slows down generation slightlypublic CharSequence removeAccents(CharSequence str)
str
- a string that may contain accented Latin-script charactersprotected boolean checkAll(CharSequence testing, regexodus.Pattern[] checks)
public String word(boolean capitalize)
capitalize
- true if the word should start with a capital letter, false otherwisepublic String word(RNG rng, boolean capitalize)
rng
- the RNG to use for the randomized string buildingcapitalize
- true if the word should start with a capital letter, false otherwisepublic String word(RNG rng, boolean capitalize, int approxSyllables)
rng
- the RNG to use for the randomized string buildingcapitalize
- true if the word should start with a capital letter, false otherwisepublic String sentence(int minWords, int maxWords)
minWords
- an int for the minimum number of words in a sentence; should be at least 1maxWords
- an int for the maximum number of words in a sentence; should be at least equal to minWordspublic String sentence(int minWords, int maxWords, String[] midPunctuation, String[] endPunctuation, double midPunctuationFrequency)
minWords
- an int for the minimum number of words in a sentence; should be at least 1maxWords
- an int for the maximum number of words in a sentence; should be at least equal to minWordsmidPunctuation
- a String array where each element is a comma, semicolon, or the like that goes before a
space in the middle of a sentenceendPunctuation
- a String array where each element is a period, question mark, or the like that goes at
the very end of a sentencemidPunctuationFrequency
- a double between 0.0 and 1.0 that determines how often Strings from
midPunctuation should be inserted before spacespublic String sentence(RNG rng, int minWords, int maxWords, String[] midPunctuation, String[] endPunctuation, double midPunctuationFrequency)
rng
- the RNG to use for the randomized string buildingminWords
- an int for the minimum number of words in a sentence; should be at least 1maxWords
- an int for the maximum number of words in a sentence; should be at least equal to minWordsmidPunctuation
- a String array where each element is a comma, semicolon, or the like that goes before a
space in the middle of a sentenceendPunctuation
- a String array where each element is a period, question mark, or the like that goes at
the very end of a sentencemidPunctuationFrequency
- a double between 0.0 and 1.0 that determines how often Strings from
midPunctuation should be inserted before spacespublic String sentence(int minWords, int maxWords, String[] midPunctuation, String[] endPunctuation, double midPunctuationFrequency, int maxChars)
minWords
- an int for the minimum number of words in a sentence; should be at least 1maxWords
- an int for the maximum number of words in a sentence; should be at least equal to minWordsmidPunctuation
- a String array where each element is a comma, semicolon, or the like that goes before a
space in the middle of a sentenceendPunctuation
- a String array where each element is a period, question mark, or the like that goes at
the very end of a sentencemidPunctuationFrequency
- a double between 0.0 and 1.0 that determines how often Strings from
midPunctuation should be inserted before spacesmaxChars
- the longest string length this can produce; should be at least 6 * minWords
public String sentence(RNG rng, int minWords, int maxWords, String[] midPunctuation, String[] endPunctuation, double midPunctuationFrequency, int maxChars)
rng
- the RNG to use for the randomized string buildingminWords
- an int for the minimum number of words in a sentence; should be at least 1maxWords
- an int for the maximum number of words in a sentence; should be at least equal to minWordsmidPunctuation
- a String array where each element is a comma, semicolon, or the like that goes before a
space in the middle of a sentenceendPunctuation
- a String array where each element is a period, question mark, or the like that goes at
the very end of a sentencemidPunctuationFrequency
- a double between 0.0 and 1.0 that determines how often Strings from
midPunctuation should be inserted before spacesmaxChars
- the longest string length this can produce; should be at least 6 * minWords
protected String[] accentVowels(RNG rng, String[] me, double influence)
protected String[] accentConsonants(RNG rng, String[] me, double influence)
protected String[] accentBoth(RNG rng, String[] me, double vowelInfluence, double consonantInfluence)
public FakeLanguageGen mix(FakeLanguageGen other, double otherInfluence)
public FakeLanguageGen addAccents(double vowelInfluence, double consonantInfluence)
public FakeLanguageGen removeAccents()
public FakeLanguageGen addModifiers(Collection<FakeLanguageGen.Modifier> mods)
mods
- an array or vararg of Modifier objectspublic FakeLanguageGen addModifiers(FakeLanguageGen.Modifier... mods)
mods
- an array or vararg of Modifier objectspublic FakeLanguageGen removeModifiers()
public static FakeLanguageGen.Modifier modifier(String pattern, String replacement)
public static FakeLanguageGen.Modifier modifier(String pattern, String replacement, double chance)
public FakeLanguageGen copy()
Copyright © 2012–2016. All rights reserved.