public class FakeLanguageGen
extends java.lang.Object
implements java.io.Serializable
registered
and their names in registeredNames
, plus the languages that would make sense for
real-world cultures to use (and all use the Latin alphabet, so they can be swapped around) are in
romanizedHumanLanguages
. You can make a new language with a constructor, but it's pretty time-consuming; the
recommended ways are generating a random language with randomLanguage(long)
(when you don't care too much
about exactly how it should sound), or blending two or more languages with mixAll(Object...)
or
mix(double, FakeLanguageGen, double, Object...)
(when you have a sound in mind that isn't quite met by an
existing language).
Modifier and Type | Class and Description |
---|---|
static class |
FakeLanguageGen.Alteration |
static class |
FakeLanguageGen.Modifier |
static class |
FakeLanguageGen.SentenceForm
A simple way to bundle a FakeLanguageGen with the arguments that would be passed to it when calling
sentence(IRNG, int, int, String[], String[], double, int) or one of its overloads. |
Modifier and Type | Field and Description |
---|---|
static FakeLanguageGen |
ALIEN_A
Fantasy/sci-fi language that could be spoken by some very-non-human culture that would typically be fitting for
an alien species.
|
static FakeLanguageGen |
ALIEN_E
Fantasy/sci-fi language that could be spoken by some very-non-human culture that would typically be fitting for
an alien species.
|
static FakeLanguageGen |
ALIEN_I
Fantasy/sci-fi language that could be spoken by some very-non-human culture that would typically be fitting for
an alien species.
|
static FakeLanguageGen |
ALIEN_O
Fantasy/sci-fi language that could be spoken by some very-non-human culture that would typically be fitting for
an alien species.
|
static FakeLanguageGen |
ALIEN_U
Fantasy/sci-fi language that could be spoken by some very-non-human culture that would typically be fitting for
an alien species.
|
static FakeLanguageGen |
ANCIENT_EGYPTIAN
A (necessarily) very rough anglicization of Old Egyptian, a language that has no precisely known pronunciation
rules and was written with hieroglyphics.
|
static java.lang.String |
anyConsonant
A pattern String that will match any vowel FakeLanguageGen can produce out-of-the-box, including Latin, Greek,
and Cyrillic; for use when a String will be interpreted as a regex (as in
FakeLanguageGen.Alteration ). |
static java.lang.String |
anyConsonantCluster
A pattern String that will match any vowel FakeLanguageGen can produce out-of-the-box, including Latin, Greek,
and Cyrillic; for use when a String will be interpreted as a regex (as in
FakeLanguageGen.Alteration ). |
static java.lang.String |
anyVowel
A pattern String that will match any vowel FakeLanguageGen can produce out-of-the-box, including Latin, Greek,
and Cyrillic; for use when a String will be interpreted as a regex (as in
FakeLanguageGen.Alteration ). |
static java.lang.String |
anyVowelCluster
A pattern String that will match any vowel FakeLanguageGen can produce out-of-the-box, including Latin, Greek,
and Cyrillic; for use when a String will be interpreted as a regex (as in
FakeLanguageGen.Alteration ). |
static FakeLanguageGen |
ARABIC_ROMANIZED
Imitation Arabic, using mostly the Latin alphabet but with some Greek letters for tough transliteration topics.
|
static FakeLanguageGen |
CELESTIAL
Fantasy language that is meant to sound like it could be spoken by divine or (magical) otherworldly beings.
|
static FakeLanguageGen |
CHEROKEE_ROMANIZED
A rough imitation of the Cherokee language, using an attempt at romanizing the syllabary the language is often
written with, using only the parts of the language that are usually written down.
|
static FakeLanguageGen |
CHINESE_ROMANIZED
An approximation of Hanyu Pinyin, a Romanization technique used for Mandarin Chinese that has been in common use
since the 1980s.
|
boolean |
clean |
java.lang.String[] |
closingConsonants |
java.lang.String[] |
closingSyllables |
protected static regexodus.Pattern |
consonantClusters |
static FakeLanguageGen |
CROW
A rough imitation of the Crow language of the American Midwest, using some tone marks.
|
static FakeLanguageGen |
DEEP_SPEECH
Fantasy/sci-fi language that would potentially be fitting for a trade language spoken by various very-different
groups, such as creatures with tentacled faces who need to communicate with spider-elves and living crystals.
|
static FakeLanguageGen |
DEMONIC
Fantasy language that might be suitable for a language spoken by demons, aggressive warriors, or people who seek
to emulate or worship similar groups.
|
static FakeLanguageGen |
DRAGON
Fantasy language that tries to sound like the speech of a powerful and pompous dragon, using long, complex words
and a mix of hard consonants like "t" and "k", "liquid" consonants like "l" and "r", and sometimes vowel groups
like "ie" and "aa".
|
static FakeLanguageGen |
ELF
Fantasy language that tries to imitate the various languages spoken by elves in J.R.R.
|
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 the (many) accented vowels that are present in the language.
|
static FakeLanguageGen |
GOBLIN
Fantasy language that might be suitable for stealthy humanoids, such as goblins, or as a secret language used
by humans who want to avoid notice.
|
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_ROMANIZED
Imitation Hindi, romanized to use the Latin alphabet using accented glyphs similar to the IAST standard.
|
static FakeLanguageGen |
HLETKIP
A fictional language that could ostensibly be spoken by some group of humans, but that isn't closely based on any
one real-world language.
|
static FakeLanguageGen |
IMP
A fantasy language meant for obnoxious screeching annoying enemies more-so than for intelligent friends or foes.
|
static FakeLanguageGen |
INFERNAL
Fantasy language that might be suitable for a language spoken by fiends, users of witchcraft, or people who seek
to emulate or worship similar groups.
|
static FakeLanguageGen |
INSECT
Fantasy/sci-fi language that would typically be fitting for an insect-like species without a close equivalent to
human lips.
|
static FakeLanguageGen |
INUKTITUT
Imitation text from an approximation of one of the Inuktitut languages spoken by various people of the Arctic and
nearby areas.
|
static FakeLanguageGen |
JAPANESE_ROMANIZED
Imitation Japanese, romanized to use the Latin alphabet.
|
static FakeLanguageGen |
KOBOLD
Fantasy language based closely on
DRAGON , but with much shorter words normally and closing syllables
that may sound "rushed" or "crude", though it has the same general frequency of most consonants and vowels. |
static FakeLanguageGen |
KOREAN_ROMANIZED
Imitation text from an approximation of Korean, using the Revised Romanization method that is official in South
Korea today and is easier to type.
|
static FakeLanguageGen |
LATIN
An imitation of Classical Latin, using some modern conventions so it can be suitable for scientific names or
other common English uses of Latin words.
|
static FakeLanguageGen |
LOVECRAFT
Ia! Ia! Cthulhu Rl'yeh ftaghn! Useful for generating cultist ramblings or unreadable occult texts.
|
static FakeLanguageGen |
MALAY
An approximation of the Malay language or any of its close relatives, such as Indonesian.
|
static FakeLanguageGen |
MAORI
Imitation text from an approximation of the Maori language, spoken in New Zealand both today and historically,
and closely related to some other Polynesian languages.
|
java.lang.String[] |
midConsonants |
java.lang.String[] |
midVowels |
java.util.ArrayList<FakeLanguageGen.Modifier> |
modifiers |
static FakeLanguageGen |
MONGOLIAN
Imitation text from an approximation of one of the languages spoken in the 13th-century Mongol Empire.
|
static FakeLanguageGen |
NAHUATL
Imitation text from an approximation of the language spoken by the Aztec people and also over a million
contemporary people in parts of Mexico.
|
protected java.lang.String |
name |
static FakeLanguageGen |
NORSE
Somewhat close to Old Norse, which is itself very close to Icelandic, so this uses Icelandic spelling rules.
|
static FakeLanguageGen |
NORSE_SIMPLIFIED
Somewhat close to Old Norse, which is itself very close to Icelandic, but changed to avoid letters not on a
US-ASCII keyboard.
|
java.lang.String[] |
openingConsonants |
java.lang.String[] |
openingVowels |
static FakeLanguageGen[] |
registered
An array that stores all the hand-made FakeLanguageGen constants; it does not store randomly-generated languages
nor does it store modifications or mixes of languages.
|
static java.lang.String[] |
registeredNames |
protected static regexodus.Pattern |
repeats |
static FakeLanguageGen[] |
romanizedHumanLanguages
FakeLanguageGen constants that are meant to sound like specific real-world languages, and that all use the Latin
script (like English) with maybe some accents.
|
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 |
SIMPLISH
English-like language that omits complex spelling and doesn't include any of the uncommon word endings of English
like "ought" or "ation." A good choice when you want something that doesn't use any non-US-keyboard letters,
looks somewhat similar to English, and tries to be pronounceable without too much effort.
|
static FakeLanguageGen |
SOMALI
Imitation Somali, using the Latin alphabet.
|
static FakeLanguageGen |
SPANISH
Imitation text from an approximation of Spanish (not using the variations spoken in Spain, but closer to Latin
American forms of Spanish).
|
static GWTRNG |
srng |
protected java.lang.String |
summary |
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 |
syllableBias |
double |
syllableEndFrequency |
double[] |
syllableFrequencies |
protected double |
totalSyllableFrequency |
static FakeLanguageGen |
VIETNAMESE
A very rough imitation of the Vietnamese language, without using the accurate characters Vietnamese really uses
but that are rare in fonts.
|
protected static regexodus.Pattern |
vowelClusters |
double |
vowelEndFrequency |
double |
vowelSplitFrequency |
java.lang.String[] |
vowelSplitters |
double |
vowelStartFrequency |
Constructor and Description |
---|
FakeLanguageGen()
Zero-arg constructor for a FakeLanguageGen; produces a FakeLanguageGen equivalent to FakeLanguageGen.ENGLISH .
|
FakeLanguageGen(java.lang.String[] openingVowels,
java.lang.String[] midVowels,
java.lang.String[] openingConsonants,
java.lang.String[] midConsonants,
java.lang.String[] closingConsonants,
java.lang.String[] closingSyllables,
java.lang.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, such as LOVECRAFT and GREEK_ROMANIZED in the source code.
|
FakeLanguageGen(java.lang.String[] openingVowels,
java.lang.String[] midVowels,
java.lang.String[] openingConsonants,
java.lang.String[] midConsonants,
java.lang.String[] closingConsonants,
java.lang.String[] closingSyllables,
java.lang.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, such as LOVECRAFT and GREEK_ROMANIZED in the source code.
|
Modifier and Type | Method and Description |
---|---|
protected static java.lang.String[] |
accentBoth(IRNG rng,
java.lang.String[] me,
double vowelInfluence,
double consonantInfluence) |
protected static java.lang.String[] |
accentConsonants(IRNG rng,
java.lang.String[] me,
double influence) |
protected static java.lang.String[] |
accentVowels(IRNG rng,
java.lang.String[] me,
double influence) |
FakeLanguageGen |
addAccents(double vowelInfluence,
double consonantInfluence)
Produces a new FakeLanguageGen like this one but with extra vowels and/or consonants possible, adding from a wide
selection of accented vowels (if vowelInfluence is above 0.0) and/or consonants (if consonantInfluence is above
0.0).
|
FakeLanguageGen |
addModifiers(java.util.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 static boolean |
checkAll(java.lang.CharSequence testing,
regexodus.Pattern[] checks) |
static boolean |
checkVulgarity(java.lang.CharSequence testing)
Checks a CharSequence, such as a String, against an overzealous vulgarity filter, returning true if the text
could contain vulgar elements or words that could seem vulgar or juvenile.
|
FakeLanguageGen |
copy() |
static FakeLanguageGen |
deserializeFromString(java.lang.String data) |
boolean |
equals(java.lang.Object o) |
static FakeLanguageGen |
get(java.lang.String name)
If a FakeLanguageGen is known and is in
registered , this allows you to look up that FakeLanguageGen by
name (using a name from registeredNames ). |
static FakeLanguageGen |
getAt(int index)
If a FakeLanguageGen is known and is in
registered , this allows you to look up that FakeLanguageGen by
index, from 0 to FakeLanguageGen.registered.length - 1 . |
java.lang.String |
getName()
Returns the name of this FakeLanguageGen, such as "English" or "Deep Speech", if one was registered for this.
|
long |
hash64() |
int |
hashCode() |
protected java.lang.String[] |
merge1000(IRNG rng,
java.lang.String[] me,
java.lang.String[] other,
double otherInfluence) |
FakeLanguageGen |
mix(double myWeight,
FakeLanguageGen other1,
double weight1,
java.lang.Object... pairs)
Produces a FakeLanguageGen by mixing this FakeLanguageGen with one or more other FakeLanguageGen objects.
|
FakeLanguageGen |
mix(FakeLanguageGen other,
double otherInfluence)
Makes a new FakeLanguageGen that mixes this object with
other , mingling the consonants and vowels they
use as well as any word suffixes or other traits, and favoring the qualities in other by
otherInfluence , which will value both languages evenly if it is 0.5 . |
static FakeLanguageGen |
mixAll(java.lang.Object... pairs)
Produces a FakeLanguageGen from a group of FakeLanguageGen parameters and the weights for those parameters.
|
static FakeLanguageGen.Modifier |
modifier(java.lang.String pattern,
java.lang.String replacement)
Convenience method that just calls
Modifier(String, String) . |
static FakeLanguageGen.Modifier |
modifier(java.lang.String pattern,
java.lang.String replacement,
double chance)
Convenience method that just calls
Modifier(String, String, double) . |
static java.lang.String |
nameAt(int index)
If a FakeLanguageGen is known and is in
registered , this allows you to look up that FakeLanguageGen's
name by index, from 0 to FakeLanguageGen.registeredNames.length - 1 . |
static FakeLanguageGen |
randomLanguage(IRNG rng) |
static FakeLanguageGen |
randomLanguage(long seed) |
FakeLanguageGen |
removeAccents()
Useful for cases with limited fonts, this produces a new FakeLanguageGen like this one but with all accented
characters removed (including almost all non-ASCII Latin-alphabet characters, but only some Greek and Cyrillic
characters).
|
static java.lang.CharSequence |
removeAccents(java.lang.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.
|
java.lang.String |
sentence(int minWords,
int maxWords)
Generate a sentence from this FakeLanguageGen, using and changing the current seed, with the length in words
between minWords and maxWords, both inclusive.
|
java.lang.String |
sentence(int minWords,
int maxWords,
java.lang.String[] midPunctuation,
java.lang.String[] endPunctuation,
double midPunctuationFrequency)
Generate a sentence from this FakeLanguageGen, using and changing the current seed.
|
java.lang.String |
sentence(int minWords,
int maxWords,
java.lang.String[] midPunctuation,
java.lang.String[] endPunctuation,
double midPunctuationFrequency,
int maxChars)
Generate a sentence from this FakeLanguageGen that fits in the given length limit.
|
java.lang.String |
sentence(IRNG rng,
int minWords,
int maxWords)
Generate a sentence from this FakeLanguageGen, using the given RNG, with the length in words between minWords and
maxWords, both inclusive.
|
java.lang.String |
sentence(IRNG rng,
int minWords,
int maxWords,
java.lang.String[] midPunctuation,
java.lang.String[] endPunctuation,
double midPunctuationFrequency)
Generate a sentence from this FakeLanguageGen using the specific RNG.
|
java.lang.String |
sentence(IRNG rng,
int minWords,
int maxWords,
java.lang.String[] midPunctuation,
java.lang.String[] endPunctuation,
double midPunctuationFrequency,
int maxChars)
Generate a sentence from this FakeLanguageGen using the given RNG that fits in the given length limit.
|
java.lang.String |
sentence(long seed,
int minWords,
int maxWords)
Generate a sentence from this FakeLanguageGen, using the given seed as a long, with the length in words between
minWords and maxWords, both inclusive.
|
java.lang.String |
sentence(long seed,
int minWords,
int maxWords,
java.lang.String[] midPunctuation,
java.lang.String[] endPunctuation,
double midPunctuationFrequency)
Generate a sentence from this FakeLanguageGen, using the given seed as a long.
|
java.lang.String |
sentence(long seed,
int minWords,
int maxWords,
java.lang.String[] midPunctuation,
java.lang.String[] endPunctuation,
double midPunctuationFrequency,
int maxChars)
Generate a sentence from this FakeLanguageGen that fits in the given length limit, using the given seed as a
long.
|
java.lang.String |
serializeToString() |
java.lang.String |
toString() |
java.lang.String |
word(boolean capitalize)
Generate a word from this FakeLanguageGen, using and changing the current seed.
|
java.lang.String |
word(IRNG rng,
boolean capitalize)
Generate a word from this FakeLanguageGen using the specified RNG.
|
java.lang.String |
word(IRNG rng,
boolean capitalize,
int approxSyllables)
Generate a word from this FakeLanguageGen using the specified RNG with an approximate number of syllables.
|
java.lang.String |
word(IRNG rng,
boolean capitalize,
int approxSyllables,
regexodus.Pattern[] additionalChecks)
Generate a word from this FakeLanguageGen using the specified RNG with an approximate number of syllables.
|
java.lang.String |
word(IStatefulRNG rng,
boolean capitalize,
int approxSyllables,
long... reseeds)
Generate a word from this FakeLanguageGen using the specified StatefulRNG with an approximate number of
syllables, potentially setting the state of rng mid-way through the word to another seed from
reseeds
more than once if the word is long enough. |
java.lang.String |
word(long seed,
boolean capitalize)
Generate a word from this FakeLanguageGen using the specified long seed to use for a shared StatefulRNG.
|
java.lang.String |
word(long seed,
boolean capitalize,
int approxSyllables)
Generate a word from this FakeLanguageGen with an approximate number of syllables using the specified long seed
to use for a shared StatefulRNG.
|
java.lang.String |
word(long seed,
boolean capitalize,
int approxSyllables,
regexodus.Pattern[] additionalChecks)
Generate a word from this FakeLanguageGen with an approximate number of syllables using the specified long seed
to use for a shared StatefulRNG.
|
public final java.lang.String[] openingVowels
public final java.lang.String[] midVowels
public final java.lang.String[] openingConsonants
public final java.lang.String[] midConsonants
public final java.lang.String[] closingConsonants
public final java.lang.String[] vowelSplitters
public final java.lang.String[] closingSyllables
public final boolean clean
public final double[] syllableFrequencies
protected final double totalSyllableFrequency
public final double syllableBias
public final double vowelStartFrequency
public final double vowelEndFrequency
public final double vowelSplitFrequency
public final double syllableEndFrequency
public final regexodus.Pattern[] sanityChecks
public final java.util.ArrayList<FakeLanguageGen.Modifier> modifiers
public static final GWTRNG srng
protected java.lang.String summary
protected java.lang.String name
public static final java.lang.String anyVowel
FakeLanguageGen.Alteration
).public static final java.lang.String anyVowelCluster
FakeLanguageGen.Alteration
).public static final java.lang.String anyConsonant
FakeLanguageGen.Alteration
).public static final java.lang.String anyConsonantCluster
FakeLanguageGen.Alteration
).protected static final regexodus.Pattern repeats
protected static final regexodus.Pattern vowelClusters
protected static final regexodus.Pattern consonantClusters
public static final FakeLanguageGen LOVECRAFT
mixAll(Object...)
; using some very different
languages in low amounts relative to the amount used for this, like NAHUATL
, INUKTITUT
,
SOMALI
, DEEP_SPEECH
, and INSECT
can alter the aesthetic of the generated text in ways
that may help distinguish magic styles.
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. You may want to get a variant on this language with removeAccents()
if you can't display the
less-commonly-supported glyphs āīūĕĭáíúóŗŕļţĺđńñņśş
. For some time SquidLib had a separate version of
imitation Hindi that was accurate to the IAST standard, but this version is more usable because font support is
much better for the glyphs it uses, so the IAST kind was removed (it added quite a bit of code for something that
was mostly unusable).
public static final FakeLanguageGen ARABIC_ROMANIZED
public static final FakeLanguageGen INUKTITUT
public static final FakeLanguageGen NORSE
FakeLanguageGen.Modifier.SIMPLIFY_NORSE
on this language or
some mix of this with other languages; it also changes some of the usage of "j" where it means the English "y"
sound, making "fjord" into "fyord", which is closer to familiar uses from East Asia like "Tokyo" and "Pyongyang".
You can also now use NORSE_SIMPLIFIED
directly, which is probably easiest.
public static final FakeLanguageGen NAHUATL
public static final FakeLanguageGen MONGOLIAN
public static final FakeLanguageGen FANTASY_NAME
public static final FakeLanguageGen FANCY_FANTASY_NAME
public static final FakeLanguageGen GOBLIN
public static final FakeLanguageGen ELF
public static final FakeLanguageGen DEMONIC
public static final FakeLanguageGen INFERNAL
public static final FakeLanguageGen SIMPLISH
public static final FakeLanguageGen ALIEN_A
public static final FakeLanguageGen KOREAN_ROMANIZED
public static final FakeLanguageGen ALIEN_E
public static final FakeLanguageGen ALIEN_I
public static final FakeLanguageGen ALIEN_O
public static final FakeLanguageGen ALIEN_U
public static final FakeLanguageGen DRAGON
public static final FakeLanguageGen KOBOLD
DRAGON
, but with much shorter words normally and closing syllables
that may sound "rushed" or "crude", though it has the same general frequency of most consonants and vowels.
This means it still uses lots of "t", "k", and "r", can group two vowels sometimes, and when there's a consonant
in the middle of a word, it is often accompanied by an "r" on one or both sides. If used with
NaturalLanguageCipher
, this will look very similar to DRAGON, because the syllable lengths aren't
determined by this object but by the text being ciphered. Still, the ends of words are often different. It is
called KOBOLD because, even though the original kobold myth was that of a goblin-like spirit that haunted cobalt
mines, the modern RPG treatment of kobolds frequently describes them as worshippers of dragons or in some way
created by dragons, but generally they're a sort of failure to live up to a dragon's high expectations. The feel
of this language is meant to be something like a dragon's speech, but much less "fancy" and rather curt.
public static final FakeLanguageGen INSECT
ALIEN_E
by not having harder-to-explain click
sounds, and adjusting vowels/sibilants a fair bit.
public static final FakeLanguageGen MAORI
public static final FakeLanguageGen SPANISH
public static final FakeLanguageGen DEEP_SPEECH
public static final FakeLanguageGen NORSE_SIMPLIFIED
FakeLanguageGen.Modifier.SIMPLIFY_NORSE
to NORSE
. This replaces eth ('Ðð') and thorn ('Þþ') with 'th' unless preceded by 's' (where 'sð' or 'sþ'
becomes "st") or followed by 'r' (where 'ðr' or 'þr' becomes 'fr'). It replaces 'Æ' or 'æ' with 'Ae' or 'ae', and
replaces 'Ö' or 'ö' with 'Ou' or "ou", which can change the length of a String relative to NORSE. It removes all
other accent marks (since the two-dot umlaut accent has already been changed, this only affects acute accents).
It also changes some of the usage of "j" where it means the English "y" sound, making "fjord" into "fyord", which
is closer to familiar uses from East Asia like "Tokyo" and "Pyongyang".
public static final FakeLanguageGen HLETKIP
public static final FakeLanguageGen ANCIENT_EGYPTIAN
public static final FakeLanguageGen CROW
public static final FakeLanguageGen IMP
public static final FakeLanguageGen MALAY
public static final FakeLanguageGen CELESTIAL
ăĕĭŏ
) over vowels and rarely splits consonants with '
.
Uses very few harsh sounds, and may be easy to confuse with ELF
(this tends to use much shorter words).
This happens to sound a little like Hebrew, but since this doesn't have some consonants that are commonly used in
Hebrew, and because this uses accented vowels that aren't in Hebrew, they should be different enough that this
language can seem "not of this world."
public static final FakeLanguageGen CHINESE_ROMANIZED
public static final FakeLanguageGen CHEROKEE_ROMANIZED
public static final FakeLanguageGen VIETNAMESE
public static final FakeLanguageGen LATIN
public static final FakeLanguageGen[] registered
serializeToString()
output, but neither is dependent on the other if this
array is changed for some reason (which is not recommended, but not out of the question). If this is modified,
then it is probably a bad idea to assign null to any elements in registered; special care is taken to avoid null
elements in its original state, so some code may rely on the items being usable and non-null.public static final java.lang.String[] registeredNames
public static final FakeLanguageGen[] romanizedHumanLanguages
public FakeLanguageGen()
public FakeLanguageGen(java.lang.String[] openingVowels, java.lang.String[] midVowels, java.lang.String[] openingConsonants, java.lang.String[] midConsonants, java.lang.String[] closingConsonants, java.lang.String[] closingSyllables, java.lang.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(java.lang.String[] openingVowels, java.lang.String[] midVowels, java.lang.String[] openingConsonants, java.lang.String[] midConsonants, java.lang.String[] closingConsonants, java.lang.String[] closingSyllables, java.lang.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 static java.lang.CharSequence removeAccents(java.lang.CharSequence str)
str
- a string that may contain accented Latin-script characterspublic static FakeLanguageGen get(java.lang.String name)
registered
, this allows you to look up that FakeLanguageGen by
name (using a name from registeredNames
).name
- a String name such as "English", "Korean Romanized", or "Russian Authentic"public static FakeLanguageGen getAt(int index)
registered
, this allows you to look up that FakeLanguageGen by
index, from 0 to FakeLanguageGen.registered.length - 1
.index
- an int from 0 to FakeLanguageGen.registered.length - 1
public static java.lang.String nameAt(int index)
registered
, this allows you to look up that FakeLanguageGen's
name by index, from 0 to FakeLanguageGen.registeredNames.length - 1
.index
- an int from 0 to FakeLanguageGen.registeredNames.length - 1
public static FakeLanguageGen randomLanguage(IRNG rng)
public static FakeLanguageGen randomLanguage(long seed)
protected static boolean checkAll(java.lang.CharSequence testing, regexodus.Pattern[] checks)
public static boolean checkVulgarity(java.lang.CharSequence testing)
testing
- the text, as a CharSequence such as a String, to checkpublic java.lang.String word(boolean capitalize)
capitalize
- true if the word should start with a capital letter, false otherwisepublic java.lang.String word(long seed, boolean capitalize)
seed
- the seed, as a long, to use for the randomized string buildingcapitalize
- true if the word should start with a capital letter, false otherwisepublic java.lang.String word(IRNG 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 java.lang.String word(long seed, boolean capitalize, int approxSyllables)
seed
- the seed, as a long, to use for the randomized string buildingcapitalize
- true if the word should start with a capital letter, false otherwiseapproxSyllables
- the approximate number of syllables to produce in the word; there may be more syllablespublic java.lang.String word(IRNG 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 otherwiseapproxSyllables
- the approximate number of syllables to produce in the word; there may be more syllablespublic java.lang.String word(long seed, boolean capitalize, int approxSyllables, regexodus.Pattern[] additionalChecks)
Pattern
objects (from RegExodus, not
java.util.regex) that should match invalid outputs, such as words that shouldn't be generated in some context due
to vulgarity or cultural matters. If seed and the other parameters are the same, a FakeLanguageGen should produce
the same word every time with this method.seed
- the seed, as a long, to use for the randomized string buildingcapitalize
- true if the word should start with a capital letter, false otherwiseapproxSyllables
- the approximate number of syllables to produce in the word; there may be more syllablesadditionalChecks
- an array of RegExodus Pattern objects that match invalid words (these may be additional vulgarity checks, for example)public java.lang.String word(IRNG rng, boolean capitalize, int approxSyllables, regexodus.Pattern[] additionalChecks)
Pattern
objects (from RegExodus, not java.util.regex) that should match invalid
outputs, such as words that shouldn't be generated in some context due to vulgarity or cultural matters.rng
- the RNG to use for the randomized string buildingcapitalize
- true if the word should start with a capital letter, false otherwiseapproxSyllables
- the approximate number of syllables to produce in the word; there may be more syllablesadditionalChecks
- an array of RegExodus Pattern objects that match invalid words (these may be additional vulgarity checks, for example)public java.lang.String word(IStatefulRNG rng, boolean capitalize, int approxSyllables, long... reseeds)
reseeds
more than once if the word is long enough. This overload is less likely to be used very often.rng
- the StatefulRNG to use for the randomized string buildingcapitalize
- true if the word should start with a capital letter, false otherwiseapproxSyllables
- the approximate number of syllables to produce in the word; there may be more syllablesreseeds
- an array or varargs of additional long seeds to seed rng
with mid-generationpublic java.lang.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 java.lang.String sentence(long seed, int minWords, int maxWords)
seed
- the seed, as a long, 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 minWordspublic java.lang.String sentence(IRNG rng, int minWords, int maxWords)
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 minWordspublic java.lang.String sentence(int minWords, int maxWords, java.lang.String[] midPunctuation, java.lang.String[] endPunctuation, double midPunctuationFrequency)
midPunctuation
between two words (before the space) at a frequency of midPunctuationFrequency
(between 0 and 1), and will end the sentence with one String chosen from endPunctuation
.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 java.lang.String sentence(long seed, int minWords, int maxWords, java.lang.String[] midPunctuation, java.lang.String[] endPunctuation, double midPunctuationFrequency)
midPunctuation
between two words (before the space) at a frequency of midPunctuationFrequency
(between 0 and 1), and will end the sentence with one String chosen from endPunctuation
.seed
- the seed, as a long, 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 java.lang.String sentence(IRNG rng, int minWords, int maxWords, java.lang.String[] midPunctuation, java.lang.String[] endPunctuation, double midPunctuationFrequency)
midPunctuation
between two words (before the space) at a frequency of midPunctuationFrequency
(between 0 and 1), and will end the sentence with one String chosen from endPunctuation
.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 java.lang.String sentence(int minWords, int maxWords, java.lang.String[] midPunctuation, java.lang.String[] endPunctuation, double midPunctuationFrequency, int maxChars)
midPunctuation
between two words (before the
space) at a frequency of midPunctuationFrequency
(between 0 and 1), and will end the sentence with one
String chosen from endPunctuation
.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 java.lang.String sentence(long seed, int minWords, int maxWords, java.lang.String[] midPunctuation, java.lang.String[] endPunctuation, double midPunctuationFrequency, int maxChars)
midPunctuation
between two words (before the space) at a frequency of midPunctuationFrequency
(between 0 and 1), and will end the sentence with one String chosen from endPunctuation
.seed
- the seed, as a long, 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
public java.lang.String sentence(IRNG rng, int minWords, int maxWords, java.lang.String[] midPunctuation, java.lang.String[] endPunctuation, double midPunctuationFrequency, int maxChars)
midPunctuation
between two words (before the space) at a frequency of midPunctuationFrequency
(between 0 and 1), and
will end the sentence with one String chosen from endPunctuation
.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 java.lang.String[] merge1000(IRNG rng, java.lang.String[] me, java.lang.String[] other, double otherInfluence)
protected static java.lang.String[] accentVowels(IRNG rng, java.lang.String[] me, double influence)
protected static java.lang.String[] accentConsonants(IRNG rng, java.lang.String[] me, double influence)
protected static java.lang.String[] accentBoth(IRNG rng, java.lang.String[] me, double vowelInfluence, double consonantInfluence)
public FakeLanguageGen mix(FakeLanguageGen other, double otherInfluence)
other
, mingling the consonants and vowels they
use as well as any word suffixes or other traits, and favoring the qualities in other
by
otherInfluence
, which will value both languages evenly if it is 0.5 .
mix(double, FakeLanguageGen, double, Object...)
or
mixAll(Object...)
if you ever mix 3 or more languages. Chaining this mix() method can be very
counter-intuitive because the weights are relative, while in the other mix() and mixAll() they are absolute.other
- another FakeLanguageGen to mix along with this one into a new languageotherInfluence
- how much other should affect the pair, with 0.5 being equal and 1.0 being only other usedpublic FakeLanguageGen mix(double myWeight, FakeLanguageGen other1, double weight1, java.lang.Object... pairs)
mix(FakeLanguageGen, double)
method. This makes
reasoning about the ideal weights for multiple mixed languages easier; to mix 3 languages equally you can use
3 equal weights with this, whereas with mix chaining you would need to mix the first two with 0.5 and the third
with 0.33 .
mixAll(Object...)
or this method; they call the same code and
produce the same result, including the summary for serialization support. You probably shouldn't use
mix(FakeLanguageGen, double)
with two arguments in new code, since it's easy to make mistakes when
mixing three or more languages (calling that twice or more).myWeight
- the weight to assign this FakeLanguageGen in the mixother1
- another FakeLanguageGen to mix in; if null, this method will abort and return copy()
weight1
- the weight to assign other1 in the mixpairs
- may be empty, not null; otherwise must alternate between FakeLanguageGen and number (weight) elementspublic static FakeLanguageGen mixAll(java.lang.Object... pairs)
mix(FakeLanguageGen, double)
method. This makes
reasoning about the ideal weights for multiple mixed languages easier; to mix 3 languages equally you can use
3 equal weights with this, whereas with mix chaining you would need to mix the first two with 0.5 and the third
with 0.33 .
mix(double, FakeLanguageGen, double, Object...)
, which is very similar but doesn't take its parameters
in quite the same way (it isn't static, and treats the FakeLanguageGen object like the first item in pairs here).
Used internally in the deserialization code.pairs
- should have at least one item, and must alternate between FakeLanguageGen and number (weight) elementspublic FakeLanguageGen addAccents(double vowelInfluence, double consonantInfluence)
vowelInfluence
- between 0.0 and 1.0; if 0.0 will not affect vowels at allconsonantInfluence
- between 0.0 and 1.0; if 0.0 will not affect consonants at allpublic FakeLanguageGen removeAccents()
public java.lang.String getName()
mix(FakeLanguageGen, double)
or related methods, this should
produce a String like "English/French" (or "English/French/Maori" if more are mixed together). If no name was
registered, this will return "Nameless Language".public FakeLanguageGen addModifiers(java.util.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(java.lang.String pattern, java.lang.String replacement)
Modifier(String, String)
.pattern
- a String that will be interpreted as a regex pattern using Pattern
replacement
- a String that will be interpreted as a replacement string for pattern; can include "$1" and the like if pattern has groupspublic static FakeLanguageGen.Modifier modifier(java.lang.String pattern, java.lang.String replacement, double chance)
Modifier(String, String, double)
.pattern
- a String that will be interpreted as a regex pattern using Pattern
replacement
- a String that will be interpreted as a replacement string for pattern; can include "$1" and the like if pattern has groupschance
- the chance, as a double between 0 and 1, that the Modifier will take effectpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public long hash64()
public java.lang.String toString()
toString
in class java.lang.Object
public FakeLanguageGen copy()
public java.lang.String serializeToString()
public static FakeLanguageGen deserializeFromString(java.lang.String data)
Copyright © Eben Howard 2012–2022. All rights reserved.