Package squidpony

Class Thesaurus

java.lang.Object
squidpony.Thesaurus
All Implemented Interfaces:
Serializable

public class Thesaurus
extends Object
implements Serializable
A text processing class that can swap out occurrences of words and replace them with their synonyms. Created by Tommy Ettinger on 5/23/2016.
See Also:
Serialized Form
  • Field Details

  • Constructor Details

    • Thesaurus

      public Thesaurus()
      Constructs a new Thesaurus with an unseeded RNG used to shuffle word order.
    • Thesaurus

      public Thesaurus​(IRNG rng)
      Constructs a new Thesaurus, seeding its RNG (used to shuffle word order) with the next long from the given RNG.
      Parameters:
      rng - an RNG that will only be used to get one long (for seeding this class' RNG)
    • Thesaurus

      public Thesaurus​(long shuffleSeed)
      Constructs a new Thesaurus, seeding its RNG (used to shuffle word order) with shuffleSeed.
      Parameters:
      shuffleSeed - a long for seeding this class' RNG
    • Thesaurus

      public Thesaurus​(String shuffleSeed)
      Constructs a new Thesaurus, seeding its RNG (used to shuffle word order) with shuffleSeed.
      Parameters:
      shuffleSeed - a String for seeding this class' RNG
  • Method Details

    • refresh

      public void refresh​(long state)
      Changes the sequences for all groups of synonyms this can produce, effectively turning this Thesaurus into a different version that knows all the same synonyms and categories but will produce different results.
      Parameters:
      state - any long; will be given to SilkRNG.setState(long)
    • refresh

      public void refresh​(int stateA, int stateB)
      Changes the sequences for all groups of synonyms this can produce, effectively turning this Thesaurus into a different version that knows all the same synonyms and categories but will produce different results.
      Parameters:
      stateA - any int; the first part of the state of a SilkRNG
      stateB - any int; the second part of the state of a SilkRNG
    • addReplacement

      public Thesaurus addReplacement​(CharSequence before, String after)
    • addCategory

      public Thesaurus addCategory​(String keyword, Collection<String> synonyms)
      Allows this Thesaurus to replace a specific keyword, typically containing multiple backtick characters (`) so it can't be confused with a "real word," with one of the words in synonyms (chosen in shuffled order). The backtick is the only punctuation character that this class' word matcher considers part of a word, both for this reason and because it is rarely used in English text.
      Parameters:
      keyword - a word (typically containing backticks, `) that will be replaced by a word from synonyms
      synonyms - a Collection of lower-case Strings with similar meaning and the same part of speech
      Returns:
      this for chaining
    • addKnownCategories

      Adds several pre-made categories to this Thesaurus' known categories, but won't cause it to try to replace normal words with synonyms (only categories, which contain backticks in the name). The keywords this currently knows, and the words it will replace those keywords with, are:
      • calm`adj` : calm, harmonious, peaceful, placid, pleasant, serene, tranquil
      • calm`noun` : calm, harmony, kindness, peace, serenity, tranquility
      • org`noun` : association, brotherhood, fellowship, foundation, fraternity, group, guild, order, partnership
      • org`nouns` : associations, brotherhoods, fellowships, foundations, fraternities, groups, guilds, orders, partnerships
      • empire`adj` : ascendant, dynastic, emir's, hegemonic, imperial, king's, lordly, monarchic, prince's, regal, royal, sultan's
      • empire`noun` : ascendancy, commonwealth, dominion, dynasty, emirate, empire, hegemony, imperium, kingdom, monarchy, sultanate, triumvirate
      • empire`nouns` : ascendancies, commonwealths, dominions, dynasties, emirates, empires, hegemonies, imperia, kingdoms, monarchies, sultanates, triumvirates
      • emperor`noun` : emir, emperor, king, lord, pharaoh, ruler, sultan
      • emperor`nouns` : emirs, emperors, kings, lords, pharaohs, rulers, sultans
      • empress`noun` : emira, empress, lady, pharaoh, queen, ruler, sultana
      • empress`nouns` : emiras, empresses, ladies, pharaohs, queens, rulers, sultanas
      • union`adj` : allied, associated, confederated, congressional, democratic, federated, independent, people's, unified, united
      • union`noun` : alliance, coalition, confederacy, confederation, congress, faction, federation, league, republic, union
      • union`nouns` : alliances, coalitions, confederacies, confederations, congresses, factions, federations, leagues, republics, unions
      • militia`noun` : fighters, front, irregulars, liberators, militants, militia, rebellion, resistance, warriors
      • militia`nouns` : fighters, fronts, irregulars, liberators, militants, militias, rebellions, resistances, warriors
      • gang`noun` : cartel, crew, gang, mafia, mob, posse, syndicate
      • gang`nouns` : cartels, crews, gangs, mafias, mobs, posses, syndicates
      • duke`noun` : baron, duke, earl, fief, lord, shogun
      • duke`nouns` : barons, dukes, earls, fiefs, lords, shoguns
      • duchy`noun` : barony, duchy, earldom, fiefdom, lordship, shogunate
      • duchy`nouns` : baronies, duchies, earldoms, fiefdoms, lordships, shogunates
      • magical`adj` : arcane, enchanted, ensorcelled, magical, mystical, sorcerous
      • holy`adj` : auspicious, blessed, divine, godly, holy, prophetic, sacred, virtuous
      • priest`noun` : bishop, cardinal, chaplain, cleric, preacher, priest
      • priest`nouns` : bishops, cardinals, chaplains, clergy, preachers, priests
      • unholy`adj` : accursed, bewitched, macabre, occult, profane, unholy, vile
      • witch`noun` : cultist, defiler, necromancer, occultist, warlock, witch
      • witch`nouns` : cultists, defilers, necromancers, occultists, warlocks, witches
      • forest`adj` : bountiful, fertile, lush, natural, primal, verdant
      • forest`noun` : copse, forest, glen, greenery, grove, jungle, nature, woodland
      • shaman`noun` : animist, druid, shaman, warden
      • shaman`nouns` : animists, druids, shamans, wardens
      • fancy`adj` : glorious, grand, great, magnanimous, magnificent, majestic, powerful
      • evil`adj` : abhorrent, cruel, debased, evil, heinous, horrible, malevolent, nefarious, scurrilous, terrible, vile, wicked
      • villain`noun` : blasphemer, evildoer, killer, knave, monster, murderer, villain
      • villain`nouns` : blasphemers, evildoers, killers, knaves, monsters, murderers, villains
      • monster`noun` : abomination, beast, creature, demon, devil, fiend, ghoul, monster
      • monsters`nouns` : abominations, beasts, creatures, demons, devils, fiends, ghouls, monsters
      • good`adj` : compassionate, flawless, good, kind, moral, perfect, pure, righteous
      • lethal`adj` : bloodstained, cutthroat, deadly, fatal, lethal, murderous, poisonous, silent, stalking, venomous
      • lethal`noun` : assassin, blood, killer, murder, ninja, poison, razor, silence, slayer, snake, tiger, venom
      • blade`noun` : axe, blade, cutlass, flail, glaive, halberd, hammer, hatchet, katana, knife, lance, mace, maul, nunchaku, saber, scimitar, scythe, sickle, spear, stiletto, sword, trident, whip
      • bow`noun` : atlatl, bolas, bow, crossbow, dagger, javelin, longbow, net, shortbow, shuriken, sling
      • weapon`noun` : atlatl, axe, blade, bolas, bow, crossbow, cutlass, dagger, flail, glaive, halberd, hammer, hatchet, javelin, katana, knife, lance, longbow, mace, maul, net, nunchaku, saber, scimitar, scythe, shortbow, shuriken, sickle, sling, spear, stiletto, sword, trident, whip
      • musket`noun` : arquebus, blunderbuss, cannon, flintlock, matchlock, musket, wheellock
      • grenade`noun` : bomb, explosive, flamethrower, grenade, missile, rocket, warhead
      • rifle`noun` : firearm, handgun, longarm, pistol, rifle, shotgun
      • blade`nouns` : axes, blades, cutlasses, flails, glaives, halberds, hammers, hatchets, katana, knives, lances, maces, mauls, nunchaku, sabers, scimitars, scythes, sickles, spears, stilettos, swords, tridents, whips
      • bow`nouns` : atlatls, bolases, bows, crossbows, daggers, javelins, longbows, nets, shortbows, shuriken, slings
      • weapon`nouns` : atlatls, axes, blades, bolases, bows, crossbows, cutlasses, daggers, flails, glaives, halberds, hammers, hatchets, javelins, katana, knives, lances, longbows, maces, mauls, nets, nunchaku, sabers, scimitars, scythes, shortbows, shuriken, sickles, slings, spears, stilettos, swords, tridents, whips
      • musket`nouns` : arquebusses, blunderbusses, cannons, flintlocks, matchlocks, muskets, wheellocks
      • grenade`nouns` : bombs, explosives, flamethrowers, grenades, missiles, rockets, warheads
      • rifle`nouns` : firearms, handguns, longarms, pistols, rifles, shotguns
      • scifi`adj` : genetic, gravitational, laser, nanoscale, phase, photonic, plasma, quantum, tachyonic, warp
      • tech`adj` : crypto, cyber, digital, electronic, hacker, mechanical, servo, techno, turbo
      • sole`adj` : final, last, singular, sole, total, true, ultimate
      • light`adj` : bright, gleaming, glowing, luminous, lunar, radiant, shimmering, solar, stellar
      • light`noun` : dawn, gleam, glow, light, moon, radiance, shimmer, star, sun, torch
      • light`nouns` : glimmers, lights, moons, stars, suns, torches
      • shadow`noun` : blackness, darkness, gloom, murk, shadow, twilight
      • shadow`nouns` : blackness, darkness, gloom, murk, shadows, twilight
      • fire`noun` : blaze, conflagration, fire, flame, inferno, pyre
      • fire`nouns` : blazes, conflagrations, fires, flames, infernos, pyres
      • ice`noun` : blizzard, chill, cold, frost, ice, snow
      • ice`nouns` : blizzards, chills, cold, frosts, ice, snow
      • lightning`noun` : lightning, shock, spark, storm, thunder, thunderbolt
      • lightning`nouns` : lightning, shocks, sparks, storms, thunder, thunderbolts
      • ground`noun` : clay, dirt, earth, loam, mud, peat, sand, soil
      • lake`noun` : bog, fen, glade, lake, pond, puddle, sea, swamp
      • leaf`noun` : bark, blossom, branch, bud, cress, flower, leaf, root, sap, seed, shoot, stalk, stem, thorn, twig, vine, wood, wort
      • fruit`noun` : apple, banana, berry, cherry, date, fig, fruit, grape, juniper, lime, mango, melon, papaya, peach, pear, quince
      • nut`noun` : almond, bean, cashew, chestnut, hazelnut, nut, pea, peanut, pecan, walnut
      • flower`noun` : amaryllis, camellia, chrysanthemum, daisy, dandelion, flower, gardenia, hibiscus, jasmine, lantana, lilac, lily, lotus, mallow, oleander, orchid, peony, petunia, phlox, rose, tulip
      • tree`noun` : alder, beech, birch, cactus, cedar, elm, hazel, juniper, larch, magnolia, mangrove, maple, oak, palm, pine, tree, willow
      • flavor`noun` : acid, grease, herb, salt, smoke, spice, sugar
      • flavor`adj` : bitter, salty, savory, smoky, sour, spicy, sweet
      • color`adj` : black, blue, brown, gray, green, orange, red, violet, white, yellow
      • shape`adj` : delicate, drooping, fibrous, fragile, giant, hardy, hollow, long, miniature, spiny, stiff, stubby, sturdy, thorny, tufted, yielding
      • sensory`adj` : aromatic, fragrant, fuzzy, glossy, pungent, rough, rustling, smooth, soft, weeping
      • liquid`noun` : brew, broth, elixir, fluid, liquid, potion, serum, tonic
      • liquid`adj` : bubbling, congealing, effervescent, milky, murky, slimy, sloshing, swirling, thick
      • bottle`noun` : bottle, canister, flagon, flask, jug, phial, vial
      • bottle`adj` : brown glass, clear glass, curvaceous glass, dull pewter, fluted crystal, green glass, rough-cut glass, sharp-edged tin, shining silver, smoky glass, tarnished silver
      • calabash`adj` : calabash, hollow gourd, milk carton, waterskin, wineskin
      • smart`adj` : aware, brilliant, clever, cunning, genius, mindful, smart, wise
      • smart`noun` : acumen, awareness, cunning, genius, knowledge, mindfulness, smarts, wisdom
      • stupid`adj` : careless, complacent, dull, dumb, foolish, idiotic, moronic, reckless, sloppy, stupid
      • stupid`noun` : carelessness, complacency, foolishness, idiocy, recklessness, sloppiness, stupidity
      • bandit`noun` : bandit, brigand, highwayman, pirate, raider, rogue, thief
      • bandit`nouns` : bandits, brigands, highwaymen, pirates, raiders, rogues, thieves
      • soldier`noun` : combatant, fighter, mercenary, soldier, trooper, warrior
      • soldier`nouns` : combatants, fighters, mercenaries, soldiers, troops, warriors
      • guard`noun` : defender, guard, guardian, knight, paladin, protector, sentinel, shield, templar, warden, watchman
      • guard`nouns` : defenders, guardians, guards, knights, paladins, protectors, sentinels, shields, templars, wardens, watchmen
      • hunter`noun` : hunter, poacher, stalker, tracker, trapper, warden
      • explorer`noun` : explorer, nomad, pathfinder, questant, seeker, wanderer
      • hunter`nouns` : hunters, poachers, stalkers, trackers, trappers, wardens
      • explorer`nouns` : explorers, nomads, pathfinders, questants, seekers, wanderers
      • rage`noun` : anger, frenzy, fury, rage, vengeance, wrath
      • ominous`adj` : baleful, fateful, foreboding, ominous, portentous
      • many`adj` : countless, infinite, manifold, many, myriad, thousandfold, unlimited
      • impossible`adj` : abominable, forbidden, impossible, incomprehensible, indescribable, ineffable, unearthly, unspeakable
      • gaze`noun` : eye, gaze, observation, purveyance, stare, watch
      • pain`noun` : agony, excruciation, misery, pain, torture
      • god`noun` : deity, father, god, king, lord, lordship, ruler
      • goddess`noun` : deity, goddess, lady, ladyship, mother, queen, ruler
      • hero`noun` : champion, crusader, hero, knight, savior
      • heroes`nouns` : champions, crusaders, heroes, knights, saviors
      • heroine`noun` : champion, crusader, heroine, knight, maiden, savior
      • heroines`nouns` : champions, crusaders, heroines, knights, maidens, saviors
      • popular`adj` : adored, beloved, revered, worshipped
      • unpopular`adj` : despised, hated, loathed, reviled
      • glyph`noun` : glyph, mark, seal, sigil, sign, symbol
      • glyph`nouns` : glyphs, marks, seals, sigils, signs, symbols
      • power`noun` : authority, dominance, force, potency, power, strength
      • power`adj` : authoritative, dominant, forceful, potent, powerful, strong
      There are also terms, which typically produce multiple words procedurally and may use defaultLanguage. See makePlantName(), makeFruitName(), makeNutName(), makeFlowerName(), and makePotionDescription() for more info and examples.
    • plant`term` : @'s color`adj` leaf`noun`, @'s color`adj` flower`noun`, @'s color`adj` tree`noun`, @'s flower`noun`, @'s ground`noun` leaf`noun`, @'s sensory`adj`-leaf`noun`, @'s shape`adj` flower`noun`, @'s tree`noun`, color`adj` flower`noun`, color`adj` flower`noun` of @, color`adj` fruit`noun` tree`noun`, color`adj` nut`noun` tree`noun`, color`adj`-leaf`noun` flower`noun`, flavor`adj` fruit`noun` tree`noun`, flavor`adj` nut`noun` tree`noun`, flavor`noun` leaf`noun` tree`noun`, flower`noun` of @, ground`noun` flower`noun`, ground`noun` leaf`noun`, ground`noun` leaf`noun` of @, leaf`noun` of @, sensory`adj` flower`noun` of @, sensory`adj` flower`noun`-flower`noun`, sensory`adj` tree`noun` of @, sensory`adj` tree`noun`-tree`noun`, sensory`adj`-leaf`noun` flower`noun`, sensory`adj`-leaf`noun` tree`noun`, shape`adj` flower`noun`, shape`adj`-fruit`noun` tree`noun`, shape`adj`-leaf`noun` flower`noun`, shape`adj`-leaf`noun` tree`noun`
    • fruit`term` : @'s color`adj` fruit`noun`, @'s flavor`adj` fruit`noun`, @'s fruit`noun`, color`adj` fruit`noun`-fruit`noun`, flavor`adj` fruit`noun`-fruit`noun`, fruit`noun` of @
    • nut`term` : @'s color`adj` nut`noun`, @'s flavor`adj` nut`noun`, @'s nut`noun`, color`adj` nut`noun`, color`adj` nut`noun` of @, flavor`adj` nut`noun`, nut`noun` of @, sensory`adj` nut`noun`
    • flower`term` : @'s color`adj` flower`noun`, @'s flower`noun`, @'s shape`adj` flower`noun`, color`adj` flower`noun`, color`adj` flower`noun` of @, color`adj`-leaf`noun` flower`noun`, flower`noun` of @, ground`noun` flower`noun`, sensory`adj` flower`noun` of @, sensory`adj` flower`noun`-flower`noun`, sensory`adj`-leaf`noun` flower`noun`, shape`adj` flower`noun`, shape`adj`-leaf`noun` flower`noun`
    • potion`term` : a bottle`adj` bottle`noun` containing a few drops of a color`adj` liquid`noun`, a bottle`adj` bottle`noun` filled with a color`adj` liquid`noun`, a bottle`adj` bottle`noun` filled with a liquid`adj` color`adj` liquid`noun`, a bottle`adj` bottle`noun` half-filled with a liquid`adj` color`adj` liquid`noun`, a calabash`adj` filled with a color`adj` liquid`noun`
    Capitalizing the first letter in the keyword where it appears in text you call process() on will capitalize the first letter of the produced fake word. Capitalizing the second letter will capitalize the whole produced fake word. This applies only per-instance of each keyword; it won't change the internally-stored list of words.
Returns:
this for chaining
  • addArchivedCategories

    public Thesaurus addArchivedCategories​(String archive)
    Given an archive String saved by archiveCategories() (probably from another version of SquidLib), this makes the Thesaurus class act like it did in that archive, assuming the rng is seeded the same. This modifies the categories, adjective, noun, and nouns static fields, so it can affect other Thesaurus objects produced later (it won't change previously-made ones, probably).
    Parameters:
    archive - an archived String of categories produced by archiveCategories()
    Returns:
    this Thesaurus, but static state of the class will also be modified so this may affect other Thesaurus objects
  • addFakeWords

    Adds a large list of words pre-generated by FakeLanguageGen and hand-picked for fitness, and makes them accessible with a keyword based on the language. The keywords this currently knows:
    "lovecraft`pre`", "english`pre`", "greek_romanized`pre`", "greek_authentic`pre`", "french`pre`", "russian_romanized`pre`", "russian_authentic`pre`", "japanese_romanized`pre`", "swahili`pre`", "somali`pre`", "hindi_romanized`pre`", "arabic_romanized`pre`", "inuktitut`pre`", "norse`pre`", "nahuatl`pre`", "mongolian`pre`", "fantasy`pre`", "fancy_fantasy`pre`", "goblin`pre`", "elf`pre`", "demonic`pre`", "infernal`pre`", "simplish`pre`", "alien_a`pre`", "korean_romanized`pre`", "alien_e`pre`", "alien_i`pre`", "alien_o`pre`", "alien_u`pre`", "dragon`pre`", "kobold`pre`", "insect`pre`", "maori`pre`", "spanish`pre`", "deep_speech`pre`", "norse_simplified`pre`", "hletkip`pre`", "ancient_egyptian`pre`", "crow`pre`", "imp`pre`", "malay`pre`", "celestial`pre`", "chinese_romanized`pre`", "cherokee_romanized`pre`", "vietnamese`pre`"
    These correspond to similarly-named fields in FakeLanguageGen, just without `pre`; for instance "cherokee_romanized`pre`" corresponds to FakeLanguageGen.CHEROKEE_ROMANIZED. You can use these same keywords with `gen` instead of `pre` to generate at runtime based on the current RNG state, instead of using one of several pre-generated words, and doing that does not require addFakeWords() to be used.
    Capitalizing the first letter in the keyword where it appears in text you call process() on will capitalize the first letter of the produced fake word, which is often desirable for things like place names. Capitalizing the second letter will capitalize the whole produced fake word. This applies only per-instance of each keyword; it won't change the internally-stored list of words.
    Returns:
    this for chaining
  • process

    public String process​(CharSequence text)
    Given a String, StringBuilder, or other CharSequence that should contain words this knows synonyms for, this replaces each occurrence of such a known word with one of its synonyms, leaving unknown words untouched. Words that were learned together as synonyms with addSynonyms() will be replaced in such a way that an individual replacement word should not occur too close to a previous occurrence of the same word; that is, replacing the text "You fiend! You demon! You despoiler of creation; devil made flesh!", where "fiend", "demon", and "devil" are all synonyms, would never produce a string that contained "fiend" as the replacement for all three of those.
    Parameters:
    text - a CharSequence, such as a String, that contains words in the source language
    Returns:
    a String of the translated text.
  • lookup

    public String lookup​(String word)
  • makeNationName

    Generates a random possible name for a nation, such as "Iond-Gouccief Alliance" or "The Last Drayo Commonwealth". May use accented characters, as in "Thùdshù-Hyóttiálb Hegemony" or "The Glorious Chô Empire"; if you want to strip these out and replace accented chars with their un-accented counterparts, you can use FakeLanguageGen.removeAccents(CharSequence), which returns a CharSequence that can be converted to String if needed. Shortly after calling this method, but before calling it again, you can retrieve the generated random languages, if any were used while making nation names, by getting the FakeLanguageGen elements of this class' randomLanguages field. Using one of these FakeLanguageGen objects, you can produce many more words with a similar style to the nation name, like "Drayo" in "The Last Drayo Commonwealth". If more than one language was used in the nation name, as in "Thùdshù-Hyóttiálb Hegemony", you will have two languages in randomLanguages, so here "Thùdshù" would be generated by the first language, and "Hyóttiálb" by the second language. Calling this method replaces the current contents of randomLanguages, so if you want to use those languages, get them while you can. This also assigns the latestGenerated field to contain the part of the nation name without any larger titles; in the case of "The Glorious Chô Empire", the latestGenerated field would be assigned "Chô" at the same time the longer name would be returned. This field will be reassigned if this method is called again.
    Returns:
    a random name for a nation or a loose equivalent to a nation, as a String
  • makeNationName

    public String makeNationName​(FakeLanguageGen language)
    Generates a random possible name for a nation, such as "Iond-Gouccief Alliance" or "The Last Drayo Commonwealth", with the FakeLanguageGen already available instead of randomly created. May use accented characters, as in "Thùdshù Hegemony" or "The Glorious Chô Empire", if the given language can produce them; if you want to strip these out and replace accented chars with their un-accented counterparts, you can use FakeLanguageGen.removeAccents(CharSequence), which returns a CharSequence that can be converted to String if needed, or simply get an accent-less language by calling FakeLanguageGen.removeAccents() on the FakeLanguageGen you would give this. This assigns the latestGenerated field to contain the part of the nation name without any larger titles; in the case of "The Glorious Chô Empire", the latestGenerated field would be assigned "Chô" at the same time the longer name would be returned. This field will be reassigned if this method is called again.
    Some nation names use a hyphenated pairing of what would normally be names in two different languages; if one of those names is produced by this it will produce two names in the same linguistic style. The randomLanguages field is not populated by this method; it is assumed that since you are passing this a FakeLanguageGen, you already have the one you want to use anyway.
    Parameters:
    language - a FakeLanguageGen that will be used to construct any non-English names
    Returns:
    a random name for a nation or a loose equivalent to a nation, as a String
  • makePlantName

    Generates a random possible name for a plant or tree, such as "Ikesheha's maple" or "sugarleaf birch". May use accented characters, as in "Emôa's greenwood", if the given language can produce them; if you want to strip these out and replace accented chars with their un-accented counterparts, you can use FakeLanguageGen.removeAccents(CharSequence), which returns a CharSequence that can be converted to String if needed. Shortly after calling this method, but before calling it again, you can retrieve the generated random languages, if any were used while making names, by getting the FakeLanguageGen elements of this class' randomLanguages field. Using one of these FakeLanguageGen objects, you can produce many more words with a similar style to the person or place name, like "Drayo" in "The Last Drayo Commonwealth". Calling this method replaces the current contents of randomLanguages, so if you want to use those languages, get them while you can.
    Returns:
    a random name for a plant, shrub, or tree, as a String
  • makePlantName

    public String makePlantName​(FakeLanguageGen language)
    Generates a random possible name for a plant or tree, such as "Ikesheha's maple" or "sugarleaf birch", with the FakeLanguageGen already available instead of randomly created. May use accented characters, as in "Emôa's greenwood", if the given language can produce them; if you want to strip these out and replace accented chars with their un-accented counterparts, you can use FakeLanguageGen.removeAccents(CharSequence), which returns a CharSequence that can be converted to String if needed, or simply get an accent-less language by calling FakeLanguageGen.removeAccents() on the FakeLanguageGen you would give this.
    Parameters:
    language - a FakeLanguageGen that will be used to construct any non-English names
    Returns:
    a random name for a plant, shrub, or tree, as a String
  • makeFruitName

    Generates a random possible name for a plant or tree, such as "green lime-melon" or "Ung's date". May use accented characters, as in "Emôa's greenwood", if the given language can produce them; if you want to strip these out and replace accented chars with their un-accented counterparts, you can use FakeLanguageGen.removeAccents(CharSequence), which returns a CharSequence that can be converted to String if needed. Shortly after calling this method, but before calling it again, you can retrieve the generated random languages, if any were used while making names, by getting the FakeLanguageGen elements of this class' randomLanguages field. Using one of these FakeLanguageGen objects, you can produce many more words with a similar style to the person or place name, like "Drayo" in "The Last Drayo Commonwealth". Calling this method replaces the current contents of randomLanguages, so if you want to use those languages, get them while you can.
    Returns:
    a random name for a plant, shrub, or tree, as a String
  • makeFruitName

    public String makeFruitName​(FakeLanguageGen language)
    Generates a random possible name for a plant or tree, such as "green lime-melon" or "Ung's date", with the FakeLanguageGen already available instead of randomly created. May use accented characters, as in "Emôa's greenwood", if the given language can produce them; if you want to strip these out and replace accented chars with their un-accented counterparts, you can use FakeLanguageGen.removeAccents(CharSequence), which returns a CharSequence that can be converted to String if needed, or simply get an accent-less language by calling FakeLanguageGen.removeAccents() on the FakeLanguageGen you would give this.
    Parameters:
    language - a FakeLanguageGen that will be used to construct any non-English names
    Returns:
    a random name for a plant, shrub, or tree, as a String
  • makeNutName

    public String makeNutName()
    Generates a random possible name for a plant or tree, such as "nut of Gikoim" or "Pelyt's cashew". May use accented characters, as in "Emôa's greenwood", if the given language can produce them; if you want to strip these out and replace accented chars with their un-accented counterparts, you can use FakeLanguageGen.removeAccents(CharSequence), which returns a CharSequence that can be converted to String if needed. Shortly after calling this method, but before calling it again, you can retrieve the generated random languages, if any were used while making names, by getting the FakeLanguageGen elements of this class' randomLanguages field. Using one of these FakeLanguageGen objects, you can produce many more words with a similar style to the person or place name, like "Drayo" in "The Last Drayo Commonwealth". Calling this method replaces the current contents of randomLanguages, so if you want to use those languages, get them while you can.
    Returns:
    a random name for a plant, shrub, or tree, as a String
  • makeNutName

    public String makeNutName​(FakeLanguageGen language)
    Generates a random possible name for a plant or tree, such as "nut of Gikoim" or "Pelyt's cashew", with the FakeLanguageGen already available instead of randomly created. May use accented characters, as in "Emôa's greenwood", if the given language can produce them; if you want to strip these out and replace accented chars with their un-accented counterparts, you can use FakeLanguageGen.removeAccents(CharSequence), which returns a CharSequence that can be converted to String if needed, or simply get an accent-less language by calling FakeLanguageGen.removeAccents() on the FakeLanguageGen you would give this.
    Parameters:
    language - a FakeLanguageGen that will be used to construct any non-English names
    Returns:
    a random name for a plant, shrub, or tree, as a String
  • makeFlowerName

    Generates a random possible name for a plant or tree, such as "tulip of Jirui" or "Komert's thorny lilac". May use accented characters, as in "Emôa's greenwood", if the given language can produce them; if you want to strip these out and replace accented chars with their un-accented counterparts, you can use FakeLanguageGen.removeAccents(CharSequence), which returns a CharSequence that can be converted to String if needed. Shortly after calling this method, but before calling it again, you can retrieve the generated random languages, if any were used while making names, by getting the FakeLanguageGen elements of this class' randomLanguages field. Using one of these FakeLanguageGen objects, you can produce many more words with a similar style to the person or place name, like "Drayo" in "The Last Drayo Commonwealth". Calling this method replaces the current contents of randomLanguages, so if you want to use those languages, get them while you can.
    Returns:
    a random name for a plant, shrub, or tree, as a String
  • makeFlowerName

    public String makeFlowerName​(FakeLanguageGen language)
    Generates a random possible name for a plant or tree, such as "tulip of Jirui" or "Komert's thorny lilac", with the FakeLanguageGen already available instead of randomly created. May use accented characters, as in "Emôa's greenwood", if the given language can produce them; if you want to strip these out and replace accented chars with their un-accented counterparts, you can use FakeLanguageGen.removeAccents(CharSequence), which returns a CharSequence that can be converted to String if needed, or simply get an accent-less language by calling FakeLanguageGen.removeAccents() on the FakeLanguageGen you would give this.
    Parameters:
    language - a FakeLanguageGen that will be used to construct any non-English names
    Returns:
    a random name for a plant, shrub, or tree, as a String
  • makePotionDescription

    Generates a random possible description for a potion in a container, such as "a smoky glass flask containing a few drops of an orange tonic", "a milk carton filled with a red fluid", "a shining silver bottle filled with an effervescent violet potion", or "a wineskin filled with a black serum".
    Returns:
    a random description for a potion or other liquid in a container
  • numberWord

    public static String numberWord​(int number)
    Gets an English word for a given number, if this knows it. These words are known from 0 ("zero") to 20 ("twenty"), as well as some higher numbers. If a word isn't known for a number, this returns the number as a String, such as "537" or "-1".
    Parameters:
    number - the number to get a word for
    Returns:
    the word associated with a number as a String, or if none is known, String.valueOf(number).
  • numberAdjective

    public static String numberAdjective​(int number)
    Gets an English word that describes a numbered position in some sequence, if this knows it (such as "second" or "eleventh"). These words are known from 1 ("first") to 20 ("twentieth"), as well as some higher numbers. If a word isn't known for a number, this appends a suffix based on the last base-10 digit to the number, as with "0th" or "42nd".
    Parameters:
    number - the number to get a position adjective for
    Returns:
    the word associated with a number as a String, or if none is known, String.valueOf(number) followed by a two-char suffix from the last digit.
  • numberWordInRange

    public String numberWordInRange​(int lowest, int highest)
    Gets an English word for a number, if this knows it, where the number is chosen randomly between lowest and highest, both inclusive. These words are known from 0 ("zero") to 20 ("twenty"), as well as some higher numbers. If a word isn't known for a number, this returns the number as a String, such as "537" or "-1".
    Parameters:
    lowest - the lower bound for numbers this can choose, inclusive
    highest - the upper bound for numbers this can choose, inclusive
    Returns:
    a String word for a number in the given range, such as "six" or "eleven", if it is known
  • numberAdjectiveInRange

    public String numberAdjectiveInRange​(int lowest, int highest)
    Gets an English word that describes a numbered position in some sequence, if this knows it (such as "second" or "eleventh"), where the number is chosen randomly between lowest and highest, both inclusive. These words are known from 1 ("first") to 20 ("twentieth"), as well as some output for other numbers (such as "42nd" or "23rd").
    Parameters:
    lowest - the lower bound for numbers this can choose, inclusive
    highest - the upper bound for numbers this can choose, inclusive
    Returns:
    a String word for a number in the given range, such as "third" or "twelfth", if it is known
  • archiveCategories

    public static String archiveCategories()
    Gets a stable (large) String that stores all categories this version of Thesaurus knows, as well as all of the words each category includes. This can be useful in conjunction with addArchivedCategories(String) to load a set of categories stored from an earlier version of SquidLib.
    Returns:
    a category archive String that can be passed to addArchivedCategories(String)