Class Thesaurus

java.lang.Object
com.github.yellowstonegames.text.Thesaurus

public class Thesaurus extends Object
A text processing class that can swap out occurrences of special keywords and replace them with randomly-selected synonyms. For example, this can take "By the light`adj` fire`noun` in my heart, I will vanquish thee!", which has the keywords light`adj` and fire`noun`, and could produce "By the shimmering inferno in my heart, I will vanquish thee!" on one run, and "By the gleaming conflagration in my heart, I will vanquish thee!" on another. This can also generate some plant names and basic descriptions of potions, as well as make some text sound like ORK.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.github.tommyettinger.ds.CaseInsensitiveOrderedMap<com.github.tommyettinger.ds.ObjectList<String>>
     
    com.github.tommyettinger.ds.ObjectList<Language.Alteration>
     
    static final com.github.tommyettinger.ds.CaseInsensitiveOrderedMap<com.github.tommyettinger.ds.ObjectList<String>>
     
     
    protected com.github.yellowstonegames.core.GapShuffler<String>
     
    protected com.github.yellowstonegames.core.GapShuffler<String>
     
    static final com.github.tommyettinger.ds.CaseInsensitiveOrderedMap<Language>
     
     
    com.github.tommyettinger.ds.CaseInsensitiveOrderedMap<com.github.yellowstonegames.core.GapShuffler<String>>
     
    static final Language.Alteration
    An Alteration that changes certain color names so they are surrounded by color markup tags, compatible with at least libGDX color markup and TextraTypist color markup.
    static final com.github.tommyettinger.ds.CaseInsensitiveOrderedMap<com.github.tommyettinger.ds.ObjectList<String>>
     
    static final com.github.tommyettinger.ds.CaseInsensitiveOrderedMap<com.github.tommyettinger.ds.ObjectList<String>>
     
    static final com.github.tommyettinger.ds.CaseInsensitiveOrderedMap<Integer>
     
    static final com.github.tommyettinger.ds.CaseInsensitiveOrderedMap<Integer>
     
    protected com.github.yellowstonegames.core.GapShuffler<String>
     
    static final Thesaurus
    Thesaurus preset that changes all text to sound like this speaker: "Desaurus preset dat changez all text to sound liek dis speakah." You may be familiar with a certain sci-fi game that has orks who sound like this.
    protected com.github.yellowstonegames.core.GapShuffler<String>
     
    protected com.github.yellowstonegames.core.GapShuffler<String>
     
    com.github.tommyettinger.ds.ObjectList<Language>
     
    com.github.tommyettinger.random.EnhancedRandom
     
    protected static final regexodus.Pattern
     
    protected com.github.yellowstonegames.core.GapShuffler<String>
     
    protected static final regexodus.Pattern
     
    static final Thesaurus
    Thesaurus preset that sharply reduces the used letters to only: a, b, g, h, m, n, r, and z.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new Thesaurus with an unseeded RNG used to shuffle word order.
    Thesaurus(long shuffleSeed)
    Constructs a new Thesaurus, seeding its internal FlowRandom (used to shuffle word order) with shuffleSeed.
    Thesaurus(long shuffleSeedA, long shuffleSeedB)
    Constructs a new Thesaurus, seeding its FlowRandom (used to shuffle word order) with shuffleSeedA and shuffleSeedB.
    Thesaurus(com.github.tommyettinger.random.EnhancedRandom rng)
    Constructs a new Thesaurus, seeding its internal FlowRandom (used to shuffle word order) with the next long from the given EnhancedRandom.
    Thesaurus(String shuffleSeed)
    Constructs a new Thesaurus, seeding its FlowRandom (used to shuffle word order) with two different hashes of shuffleSeed (produced by Hasher.sallos and Hasher.sallos_).
  • Method Summary

    Modifier and Type
    Method
    Description
    Given an archive String saved by archiveCategoriesAlternate() (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 and uses the same algorithm/RandomnessSource.
    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).
    Adds a large list of words pre-generated by Language and hand-picked for fitness, and makes them accessible with a keyword based on the language.
    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).
     
    static String
    Gets a stable (large) String that stores all categories this version of Thesaurus knows, as well as all of the words each category includes.
    lookup(String word)
     
    Generates a random possible name for a flower or flowering plant, such as "tulip of Jirui" or "thorny lilac".
    Generates a random possible name for a flower or flowering plant, such as "tulip of Jirui" or "thorny lilac", with the Language already available instead of randomly created.
    Generates a random possible name for a fruit, such as "green lime-melon" or "Ung's date".
    Generates a random possible name for a fruit, such as "green lime-melon" or "Ung's date", with the Language already available instead of randomly created.
    Generates a random possible name for a nation, such as "Iond-Gouccief Alliance" or "The Last Drayo Commonwealth".
    Generates a random possible name for a nation, such as "Iond-Gouccief Alliance" or "The Last Drayo Commonwealth", with the Language already available instead of randomly created.
    Generates a random possible name for a nut or bean, such as "nut of Gikoim" or "Pelyt's cashew".
    Generates a random possible name for a nut or bean, such as "nut of Gikoim" or "Pelyt's cashew", with the Language already available instead of randomly created.
    Generates a random possible name for a plant or tree, such as "Ikesheha's maple" or "sugarleaf birch".
    Generates a random possible name for a plant or tree, such as "Ikesheha's maple" or "sugarleaf birch", with the Language already available instead of randomly created.
    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".
    Generates a random possible name for a vegetable, such as "miniature yam" or Iliakshe's spicy zucchini".
    Generates a random possible name for a vegetable, such as "miniature yam" or Iliakshe's spicy zucchini".
    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").
    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 nextInt lowest and highest, both inclusive.
    static String
    numberWord(int number)
    Gets an English word for a given number, if this knows it.
    numberWordInRange(int lowest, int highest)
    Gets an English word for a number, if this knows it, where the number is chosen randomly nextInt lowest and highest, both inclusive.
    void
    printCategories(boolean listFormat)
    Prints out all of the categories this knows and then all of the terms this knows, optionally using HTML list formatting.
    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.
    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.
    void
    refresh(long... states)
    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.
    void
    refresh(long stateA, long 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.
    void
    refresh(long stateA, long stateB, long stateC)
    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.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • wordMatch

      protected static final regexodus.Pattern wordMatch
    • similarFinder

      protected static final regexodus.Pattern similarFinder
    • mappings

      public com.github.tommyettinger.ds.CaseInsensitiveOrderedMap<com.github.yellowstonegames.core.GapShuffler<String>> mappings
    • alterations

      public com.github.tommyettinger.ds.ObjectList<Language.Alteration> alterations
    • rng

      public com.github.tommyettinger.random.EnhancedRandom rng
    • plantTermShuffler

      protected com.github.yellowstonegames.core.GapShuffler<String> plantTermShuffler
    • fruitTermShuffler

      protected com.github.yellowstonegames.core.GapShuffler<String> fruitTermShuffler
    • nutTermShuffler

      protected com.github.yellowstonegames.core.GapShuffler<String> nutTermShuffler
    • flowerTermShuffler

      protected com.github.yellowstonegames.core.GapShuffler<String> flowerTermShuffler
    • potionTermShuffler

      protected com.github.yellowstonegames.core.GapShuffler<String> potionTermShuffler
    • vegetableTermShuffler

      protected com.github.yellowstonegames.core.GapShuffler<String> vegetableTermShuffler
    • defaultLanguage

      public Language defaultLanguage
    • randomLanguages

      public transient com.github.tommyettinger.ds.ObjectList<Language> randomLanguages
    • latestGenerated

      public transient String latestGenerated
    • categories

      public static final com.github.tommyettinger.ds.CaseInsensitiveOrderedMap<com.github.tommyettinger.ds.ObjectList<String>> categories
    • adjective

      public static final com.github.tommyettinger.ds.CaseInsensitiveOrderedMap<com.github.tommyettinger.ds.ObjectList<String>> adjective
    • noun

      public static final com.github.tommyettinger.ds.CaseInsensitiveOrderedMap<com.github.tommyettinger.ds.ObjectList<String>> noun
    • nouns

      public static final com.github.tommyettinger.ds.CaseInsensitiveOrderedMap<com.github.tommyettinger.ds.ObjectList<String>> nouns
    • languages

      public static final com.github.tommyettinger.ds.CaseInsensitiveOrderedMap<Language> languages
    • numbers

      public static final com.github.tommyettinger.ds.CaseInsensitiveOrderedMap<Integer> numbers
    • numberAdjectives

      public static final com.github.tommyettinger.ds.CaseInsensitiveOrderedMap<Integer> numberAdjectives
    • ORK

      public static final Thesaurus ORK
      Thesaurus preset that changes all text to sound like this speaker: "Desaurus preset dat changez all text to sound liek dis speakah." You may be familiar with a certain sci-fi game that has orks who sound like this.
    • ZOMBIE

      public static final Thesaurus ZOMBIE
      Thesaurus preset that sharply reduces the used letters to only: a, b, g, h, m, n, r, and z. This apparently is the canonical set of letters that zombies can use? This will abuse the rules of proper English spelling, using r and h as vowels, kind-of, in addition to a.
    • MARKUP_COLOR_NAMES

      public static final Language.Alteration MARKUP_COLOR_NAMES
      An Alteration that changes certain color names so they are surrounded by color markup tags, compatible with at least libGDX color markup and TextraTypist color markup. This can be added to a Thesaurus' alterations field at any time. Only the color name will have its color changed (if markup is interpreting it), so something like "Your hands run red with my people's blood!" will have "red" colored... red. This immediately undoes the color change after the word ends, using the [] syntax that both markups use.
      This will only match the colors "black", "white", "red", "orange", "yellow", "green", "blue", "violet", "gray", "brown", and "pink", without regard to case.
  • Constructor Details

    • Thesaurus

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

      public Thesaurus(com.github.tommyettinger.random.EnhancedRandom rng)
      Constructs a new Thesaurus, seeding its internal FlowRandom (used to shuffle word order) with the next long from the given EnhancedRandom.
      Parameters:
      rng - an EnhancedRandom that will only be used to get one long (for seeding this class' internal FlowRandom)
    • Thesaurus

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

      public Thesaurus(long shuffleSeedA, long shuffleSeedB)
      Constructs a new Thesaurus, seeding its FlowRandom (used to shuffle word order) with shuffleSeedA and shuffleSeedB.
      Parameters:
      shuffleSeedA - a long for seeding this class' FlowRandom
      shuffleSeedB - a long for seeding this class' FlowRandom
    • Thesaurus

      public Thesaurus(String shuffleSeed)
      Constructs a new Thesaurus, seeding its FlowRandom (used to shuffle word order) with two different hashes of shuffleSeed (produced by Hasher.sallos and Hasher.sallos_).
      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. This version of refresh() is meant for cases where you either only have one long of seed, or you know the generator this uses has one state.
      Parameters:
      state - any long; will be used with EnhancedRandom.setSeed(long) on the generator shared by this and its mappings
    • refresh

      public void refresh(long stateA, long 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. This version of refresh() is meant for cases where you know the generator this uses has two states, 128 bits.
      Parameters:
      stateA - any long; the first part of a two-state EnhancedRandom like a FlowRandom
      stateB - any long; the second part of a two-state EnhancedRandom like a FlowRandom
    • refresh

      public void refresh(long stateA, long stateB, long stateC)
      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. This version of refresh() is meant for cases where you know the generator this uses has three states, 192 bits.
      Parameters:
      stateA - any long; the first part of a three-state EnhancedRandom like a TricycleRandom
      stateB - any long; the second part of a three-state EnhancedRandom like a TricycleRandom
      stateC - any long; the third part of a three-state EnhancedRandom like a TricycleRandom
    • refresh

      public void refresh(long... states)
      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. This version of refresh() is meant for cases where the generator this uses may have four or more states, or when you don't know how many long items will be in states.
      Parameters:
      states - a non-null long array, usually with length equal to EnhancedRandom.getStateCount()
    • addReplacement

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

      public Thesaurus addCategory(CharSequence 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
    • printCategories

      public void printCategories(boolean listFormat)
      Prints out all of the categories this knows and then all of the terms this knows, optionally using HTML list formatting. The list formatting could be useful for Javadocs, as it is used here. Sorts and makes unique the words in each category, but does not sort categories (to preserve the similarity of some categories at close points in the order). This is probably only going to be used internally.
      Parameters:
      listFormat - if true, this will format the output as an HTML list, otherwise it will be as plain lines
    • addKnownCategories

      public Thesaurus 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
      • monster`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, citron, date, fig, fruit, grape, juniper, kumquat, lemon, lime, loquat, mango, melon, papaya, peach, pear, pineapple, plum, quince
      • nut`noun` : almond, bean, cashew, chestnut, coconut, hazelnut, lentil, nut, pea, peanut, pecan, pistachio, walnut
      • vegetable`noun` : artichoke, asparagus, avocado, barley, beet, broccoli, cabbage, carrot, cauliflower, celery, corn, eggplant, fennel, garlic, kale, leek, lettuce, mushroom, onion, parsley, potato, pumpkin, radish, rhubarb, rice, rutabaga, spinach, taro, tomato, truffle, wheat, yam, zucchini
      • flower`noun` : amaryllis, camellia, chrysanthemum, daisy, dandelion, flower, gardenia, hibiscus, jasmine, lantana, lilac, lily, lotus, mallow, oleander, orchid, peony, petunia, phlox, plumeria, rose, tulip, yarrow
      • tree`noun` : alder, beech, birch, cactus, cedar, elm, eucalyptus, ficus, hazel, juniper, larch, magnolia, mangrove, maple, oak, palm, pine, tree, willow
      • bush`noun` : aloe, boxwood, bramble, brier, brush, bush, dogwood, fern, flax, hawthorn, hedge, hemp, holly, honeysuckle, kudzu, manzanita, mesquite, milkweed, nettle, privet, ragweed, ragwort, shrub, silkweed, sorrel, tansy, tea, thicket, thistle, tobacco
      • flavor`noun` : acid, grease, salt, smoke, soap, spice, sugar
      • flavor`adj` : bitter, salty, savory, smoky, sour, spicy, sweet
      • color`adj` : black, blue, brown, gray, green, orange, pink, red, violet, white, yellow
      • shape`adj` : arched, crusty, delicate, diminutive, drooping, fibrous, flat, fragile, giant, hardy, hollow, large, long, massive, miniature, ovate, pored, ridged, small, spiny, spongy, stiff, stubby, sturdy, tattered, thorny, toothy, tufted, yielding
      • sensory`adj` : aromatic, feathery, fragrant, furry, fuzzy, glossy, hairy, pungent, rough, rustling, scaly, shaggy, smooth, soft, spotted, striped, 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`noun` : calabash, hollow gourd, milk carton, waterskin, wineskin
      • lotion`noun` : balm, cream, lotion, oil, ointment, poultice
      • lotion`adj` : greasy, herbal, lumpy, pleasant, reeking, runny, slimy, soothing, sticky, stinking
      • 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, rancor, vengeance, wrath
      • rage`adj` : angry, frenzied, furious, raging, rancorous, vengeful, wrathful
      • ominous`adj` : baleful, fateful, foreboding, ominous, portentous
      • infinite`adj` : boundless, countless, infinite, manifold, 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
      • pain`adj` : agonizing, excruciating, miserable, painful, tortuous
      • 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
      • hero`nouns` : champions, crusaders, heroes, knights, saviors
      • heroine`noun` : champion, crusader, heroine, knight, maiden, savior
      • heroine`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(), makeVegetableName(), and makePotionDescription() for more info and examples.
      • plant`term` : @'s bush`noun`, @'s bush`noun`-bush`noun`, @'s bush`noun`-tree`noun`, @'s color`adj` leaf`noun`, @'s color`adj` flower`noun`, @'s color`adj` tree`noun`, @'s flower`noun`, @'s flower`noun`-bush`noun`, @'s ground`noun` leaf`noun`, @'s sensory`adj`-leaf`noun`, @'s shape`adj` bush`noun`, @'s shape`adj` flower`noun`, @'s tree`noun`, @'s tree`noun`-bush`noun`, @'s tree`noun`-tree`noun`, bush`noun` of @, bush`noun`-bush`noun`, bush`noun`-bush`noun` of @, bush`noun`-tree`noun`, bush`noun`-tree`noun` of @, color`adj` leaf`noun` bush`noun`, color`adj` leaf`noun` tree`noun`, color`adj` bush`noun`, color`adj` flower`noun`, color`adj` flower`noun` of @, color`adj` fruit`noun` tree`noun`, color`adj` nut`noun` tree`noun`, color`adj` tree`noun`, color`adj`-leaf`noun` bush`noun`, color`adj`-leaf`noun` flower`noun`, color`adj`-leaf`noun` tree`noun`, color`adj`-vegetable`noun` tree`noun`, flavor`adj` fruit`noun` tree`noun`, flavor`adj` nut`noun` tree`noun`, flavor`noun` leaf`noun` tree`noun`, flower`noun` of @, flower`noun`-bush`noun`, flower`noun`-bush`noun` of @, fruit`noun` bush`noun`, fruit`noun` tree`noun`, ground`noun` flower`noun`, ground`noun` leaf`noun`, ground`noun` leaf`noun` of @, ground`noun` vegetable`noun`, leaf`noun` of @, nut`noun` bush`noun`, nut`noun` tree`noun`, sensory`adj` bush`noun`, sensory`adj` bush`noun`-bush`noun`, sensory`adj` bush`noun`-tree`noun`, sensory`adj` flower`noun` of @, sensory`adj` flower`noun`-bush`noun`, sensory`adj` flower`noun`-flower`noun`, sensory`adj` tree`noun`, sensory`adj` tree`noun` of @, sensory`adj` tree`noun`-bush`noun`, sensory`adj` tree`noun`-tree`noun`, sensory`adj`-leaf`noun` bush`noun`, sensory`adj`-leaf`noun` flower`noun`, sensory`adj`-leaf`noun` of @, sensory`adj`-leaf`noun` tree`noun`, shape`adj` bush`noun` of @, shape`adj` flower`noun`, shape`adj`-fruit`noun` tree`noun`, shape`adj`-leaf`noun` flower`noun`, shape`adj`-leaf`noun` tree`noun`, shape`adj`-vegetable`noun` tree`noun`, tree`noun`-bush`noun`, tree`noun`-bush`noun` of @, tree`noun`-tree`noun`, tree`noun`-tree`noun` of @, vegetable`noun` bush`noun`, vegetable`noun` tree`noun`, vegetable`noun`-leaf`noun` tree`noun`
      • fruit`term` : @'s color`adj` fruit`noun`, @'s flavor`adj` fruit`noun`, @'s fruit`noun`, @'s sensory`adj` fruit`noun`, @'s shape`adj` fruit`noun`, color`adj` fruit`noun`, color`adj` fruit`noun` of @, color`adj` fruit`noun`-fruit`noun`, flavor`adj` fruit`noun`, flavor`adj` fruit`noun` of @, flavor`adj` fruit`noun`-fruit`noun`, fruit`noun` of @, nut`noun`-fruit`noun`, sensory`adj` fruit`noun`, sensory`adj` fruit`noun` of @, sensory`adj` fruit`noun`-fruit`noun`, shape`adj` fruit`noun`, shape`adj` fruit`noun` of @, shape`adj` fruit`noun`-fruit`noun`, vegetable`noun`-fruit`noun`
      • 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`
      • vegetable`term` : @'s color`adj` vegetable`noun`, @'s flavor`adj` vegetable`noun`, @'s ground`noun`-vegetable`noun`, @'s vegetable`noun`, @'s vegetable`noun`-vegetable`noun`, color`adj` ground`noun`-vegetable`noun`, color`adj` sensory`adj` vegetable`noun`, color`adj` vegetable`noun`, color`adj` vegetable`noun` of @, color`adj` vegetable`noun`-vegetable`noun`, flavor`adj` ground`noun`-vegetable`noun`, flavor`adj` vegetable`noun`, flavor`adj` vegetable`noun`-vegetable`noun`, ground`noun`-vegetable`noun`, sensory`adj` ground`noun`-vegetable`noun`, sensory`adj` shape`adj` vegetable`noun`, sensory`adj` vegetable`noun`, sensory`adj` vegetable`noun`-vegetable`noun`, shape`adj` color`adj` vegetable`noun`, shape`adj` ground`noun`-vegetable`noun`, shape`adj` vegetable`noun`, shape`adj` vegetable`noun`-vegetable`noun`, vegetable`noun` of @
      • 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`noun` 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
    • addArchivedCategoriesAlternate

      public Thesaurus addArchivedCategoriesAlternate(String archive)
      Given an archive String saved by archiveCategoriesAlternate() (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 and uses the same algorithm/RandomnessSource. This modifies the mappings field and 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).
      If you didn't have an archive of the categories from some version of SquidLib, you can download one of the small files from the 'archives' folder of the SquidLib repo; there's an archive that acts as a snapshot of SquidLib 3.0.0's Thesaurus class, for instance. The files that use this method's format end in .alt.txt, while the other format uses .squid.txt. If you save the 3.0.0 archive in a libGDX application's assets folder, you can reload the 3.0.0 definitions into a Thesaurus called myThesaurus with:
      myThesaurus.addArchivedCategoriesAlternate(Gdx.files.internal("Thesaurus-3-0-0.alt.txt").readString("UTF-8"));
      Parameters:
      archive - an archived String of categories produced by archiveCategoriesAlternate()
      Returns:
      this Thesaurus, but static state of the class will also be modified so this may affect other Thesaurus objects
    • addFakeWords

      public Thesaurus addFakeWords()
      Adds a large list of words pre-generated by Language 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`", "latin`pre`"
      These correspond to similarly-named fields in Language, just with `pre`; for instance "cherokee_romanized`pre`" corresponds to Language.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

      public String 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 Language.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 Language elements of this class' randomLanguages field. Using one of these Language 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(Language language)
      Generates a random possible name for a nation, such as "Iond-Gouccief Alliance" or "The Last Drayo Commonwealth", with the Language 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 Language.removeAccents(CharSequence), which returns a CharSequence that can be converted to String if needed, or simply get an accent-less language by calling Language.removeAccents() on the Language 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 Language, you already have the one you want to use anyway.
      Parameters:
      language - a Language 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

      public 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 Language.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 Language elements of this class' randomLanguages field. Using one of these Language 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(Language language)
      Generates a random possible name for a plant or tree, such as "Ikesheha's maple" or "sugarleaf birch", with the Language 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 Language.removeAccents(CharSequence), which returns a CharSequence that can be converted to String if needed, or simply get an accent-less language by calling Language.removeAccents() on the Language you would give this.
      Parameters:
      language - a Language that will be used to construct any non-English names
      Returns:
      a random name for a plant, shrub, or tree, as a String
    • makeFruitName

      public String makeFruitName()
      Generates a random possible name for a fruit, 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 Language.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 Language elements of this class' randomLanguages field. Using one of these Language 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(Language language)
      Generates a random possible name for a fruit, such as "green lime-melon" or "Ung's date", with the Language 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 Language.removeAccents(CharSequence), which returns a CharSequence that can be converted to String if needed, or simply get an accent-less language by calling Language.removeAccents() on the Language you would give this.
      Parameters:
      language - a Language 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 nut or bean, 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 Language.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 Language elements of this class' randomLanguages field. Using one of these Language 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(Language language)
      Generates a random possible name for a nut or bean, such as "nut of Gikoim" or "Pelyt's cashew", with the Language 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 Language.removeAccents(CharSequence), which returns a CharSequence that can be converted to String if needed, or simply get an accent-less language by calling Language.removeAccents() on the Language you would give this.
      Parameters:
      language - a Language that will be used to construct any non-English names
      Returns:
      a random name for a plant, shrub, or tree, as a String
    • makeVegetableName

      public String makeVegetableName()
      Generates a random possible name for a vegetable, such as "miniature yam" or Iliakshe's spicy zucchini". May use accented characters, as in "Fëangoh's blue cauliflower", 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 Language.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 Language elements of this class' randomLanguages field. Using one of these Language 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 vegetable, as a String
    • makeVegetableName

      public String makeVegetableName(Language language)
      Generates a random possible name for a vegetable, such as "miniature yam" or Iliakshe's spicy zucchini". with the Language already available instead of randomly created. May use accented characters, as in "Fëangoh's blue cauliflower", 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 Language.removeAccents(CharSequence), which returns a CharSequence that can be converted to String if needed, or simply get an accent-less language by calling Language.removeAccents() on the Language you would give this.
      Parameters:
      language - a Language that will be used to construct any non-English names
      Returns:
      a random name for a vegetable, as a String
    • makeFlowerName

      public String makeFlowerName()
      Generates a random possible name for a flower or flowering plant, such as "tulip of Jirui" or "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 Language.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 Language elements of this class' randomLanguages field. Using one of these Language 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(Language language)
      Generates a random possible name for a flower or flowering plant, such as "tulip of Jirui" or "thorny lilac", with the Language 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 Language.removeAccents(CharSequence), which returns a CharSequence that can be converted to String if needed, or simply get an accent-less language by calling Language.removeAccents() on the Language you would give this.
      Parameters:
      language - a Language that will be used to construct any non-English names
      Returns:
      a random name for a plant, shrub, or tree, as a String
    • makePotionDescription

      public 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 nextInt 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 nextInt 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
    • archiveCategoriesAlternate

      public static String archiveCategoriesAlternate()
      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 addArchivedCategoriesAlternate(String) to load a set of categories stored from an earlier version of SquidLib, but its intended purpose is to provide a simpler format for archival that doesn't use ObText. The code for ObText is in SquidLib 3.x, but so far is not in SquidSquad, and is unlikely to be added here.
      This yields a String that describes an OrderedMap of String keys (categories) mapped to ArrayList of String values (the words each category knows). Each key-value pair is one line, typically separated by "\n" (but because various OS properties can affect line endings, "\r\n" must also be handled). Items within the line are separated by the non-breaking space character, Unicode 00A0. The first item on a line is the key, or the category name. Remaining items are words the category knows. This may produce a trailing newline.
      Returns:
      a category archive String that can be passed to addArchivedCategoriesAlternate(String)