diff options
author | elioat <elioat@tilde.institute> | 2024-01-06 17:49:03 -0500 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2024-01-06 17:49:03 -0500 |
commit | e0c4b62252b3a507ac0dd4272cd37a255dd4c9ba (patch) | |
tree | b2feed9fad67af67fc3c14c030feb7eacbe6b944 /js | |
parent | 02653392e6f4eefc6cde3cae4cba66e667053e3a (diff) | |
download | tour-e0c4b62252b3a507ac0dd4272cd37a255dd4c9ba.tar.gz |
*
Diffstat (limited to 'js')
-rw-r--r-- | js/bird-words/adjectives.txt | 72 | ||||
-rw-r--r-- | js/bird-words/beak.js | 33 | ||||
-rw-r--r-- | js/bird-words/lib/adjectives.txt | 228 | ||||
-rw-r--r-- | js/bird-words/lib/adverbs.txt | 140 | ||||
-rw-r--r-- | js/bird-words/lib/colors.txt | 278 | ||||
-rw-r--r-- | js/bird-words/lib/corpus.txt (renamed from js/bird-words/corpus.txt) | 0 | ||||
-rw-r--r-- | js/bird-words/lib/nouns.txt | 185 | ||||
-rw-r--r-- | js/bird-words/lib/places.txt | 64 | ||||
-rw-r--r-- | js/bird-words/lib/verbs.txt | 258 | ||||
-rw-r--r-- | js/bird-words/nouns.txt | 6 | ||||
-rw-r--r-- | js/bird-words/places.txt | 4 |
11 files changed, 1177 insertions, 91 deletions
diff --git a/js/bird-words/adjectives.txt b/js/bird-words/adjectives.txt deleted file mode 100644 index d046fd1..0000000 --- a/js/bird-words/adjectives.txt +++ /dev/null @@ -1,72 +0,0 @@ -adorable -adventurous -aggressive -agreeable -alert -alive -amused -angry -annoyed -annoying -anxious -arrogant -ashamed -attractive -average -awful -bad -beautiful -better -bewildered -black -bloody -blue -blue-eyed -blushing -bored -brainy -brave -breakable -bright -busy -calm -careful -cautious -charming -cheerful -clean -clear -clever -cloudy -clumsy -colorful -combative -comfortable -concerned -condemned -confused -cooperative -courageous -crazy -creepy -crowded -cruel -curious -cute -dangerous -dark -dead -defeated -defiant -delightful -depressed -determined -different -difficult -disgusted -distinct -disturbed -dizzy -doubtful -drab -dul \ No newline at end of file diff --git a/js/bird-words/beak.js b/js/bird-words/beak.js index 7335a98..9968d5f 100644 --- a/js/bird-words/beak.js +++ b/js/bird-words/beak.js @@ -16,10 +16,10 @@ const prettyItUp = string => { return string.charAt(0).toUpperCase() + string.slice(1) + "!"; } -let corpus = fs.readFileSync('corpus.txt', 'utf8'); +let corpus = fs.readFileSync('lib/corpus.txt', 'utf8'); let words = corpus.toLowerCase().replace(/[.,\/#!$%\^&\*;:{}=\-_`~()]/g,"").replace(/\n/g, " ").replace(/\s{2,}/g, " ").split(" "); -let markovChain = new Map(); +let markovChain = new Map(); // CONSIDER: is there a way to persist this data structure so we don't have to rebuild it every time? What does that change? for (let i = 0; i < words.length - 2; i++) { let pair = words[i] + ' ' + words[i + 1]; @@ -43,11 +43,15 @@ for (let i = 0; i < storyLength; i++) { story += " " + randomPair.split(' ')[1]; } -let nouns = fs.readFileSync('nouns.txt', 'utf8').split('\n'); -let adjectives = fs.readFileSync('adjectives.txt', 'utf8').split('\n'); -let places = fs.readFileSync('places.txt', 'utf8').split('\n'); +// CONSIDER: this *could* be generalized to be more clever, maybe pull in an arbitrary filename based on the template tag passed...but that feels sloppy and unsafe, so keeping with the naive approach for now +let places = fs.readFileSync('lib/places.txt', 'utf8').split('\n'); +let colors = fs.readFileSync('lib/colors.txt', 'utf8').split('\n'); +let nouns = fs.readFileSync('lib/nouns.txt', 'utf8').split('\n'); +let verbs = fs.readFileSync('lib/verbs.txt', 'utf8').split('\n'); +let adjectives = fs.readFileSync('lib/adjectives.txt', 'utf8').split('\n'); +let adverbs = fs.readFileSync('lib/adverbs.txt', 'utf8').split('\n'); -const fillGaps = (script, nouns, adjectives, places, markovChain, pairs) => { +const fillGaps = (script, nouns, verbs, adverbs, adjectives, places, colors, markovChain, pairs) => { return script.split('@').map(part => { if (part.startsWith('NOUN')) { return nouns[Math.floor(Math.random() * nouns.length)] + ' '; @@ -55,12 +59,23 @@ const fillGaps = (script, nouns, adjectives, places, markovChain, pairs) => { return adjectives[Math.floor(Math.random() * adjectives.length)] + ' '; } else if (part.startsWith('PLACE')) { return places[Math.floor(Math.random() * places.length)]; + } else if (part.startsWith('VERB')) { + return verbs[Math.floor(Math.random() * verbs.length)]; + } else if (part.startsWith('ADVERB')) { + return adverbs[Math.floor(Math.random() * adverbs.length)]; + } else if (part.startsWith('COLOR')) { + return colors[Math.floor(Math.random() * colors.length)]; } else if (part.startsWith('MARKOV')) { const length = parseInt(part.split(' ')[1]); + const words = part.split(' ').slice(2); let chain = ''; - let pair = pairs[Math.floor(Math.random() * pairs.length)]; + let pair = words.join(' '); for (let j = 0; j < length; j++) { - const nextWords = markovChain.get(pair); + let nextWords = markovChain.get(pair); + if (!nextWords) { + pair = pairs[Math.floor(Math.random() * pairs.length)]; + nextWords = markovChain.get(pair); + } const nextWord = nextWords[Math.floor(Math.random() * nextWords.length)]; chain += ' ' + nextWord; pair = pair.split(' ')[1] + ' ' + nextWord; @@ -78,5 +93,5 @@ if (!scriptFile) { console.log(wrap(prettyItUp(story), 40)); } else { const script = fs.readFileSync(scriptFile, 'utf8'); - console.log(wrap(prettyItUp(fillGaps(script, nouns, adjectives, places, markovChain, pairs)), 40)); + console.log(wrap(prettyItUp(fillGaps(script, nouns, verbs, adverbs, adjectives, places, colors, markovChain, pairs)), 40)); } \ No newline at end of file diff --git a/js/bird-words/lib/adjectives.txt b/js/bird-words/lib/adjectives.txt new file mode 100644 index 0000000..19354a5 --- /dev/null +++ b/js/bird-words/lib/adjectives.txt @@ -0,0 +1,228 @@ +adorable +adventurous +aggressive +agreeable +alert +alive +amused +angry +annoyed +annoying +anxious +arrogant +ashamed +attractive +average +awful +bad +beautiful +better +bewildered +black +bloody +blue +blue-eyed +blushing +bored +brainy +brave +breakable +bright +busy +calm +careful +cautious +charming +cheerful +clean +clear +clever +cloudy +clumsy +colorful +combative +comfortable +concerned +condemned +confused +cooperative +courageous +crazy +creepy +crowded +cruel +curious +cute +dangerous +dark +dead +defeated +defiant +delightful +depressed +determined +different +difficult +disgusted +distinct +disturbed +dizzy +doubtful +drab +dull +eager +easy +elated +elegant +embarrassed +enchanting +encouraging +energetic +enthusiastic +envious +evil +excited +expensive +exuberant +fair +faithful +famous +fancy +fantastic +fierce +filthy +fine +foolish +fragile +frail +frantic +friendly +frightened +funny +gentle +gifted +glamorous +gleaming +glorious +good +gorgeous +graceful +grieving +grotesque +grumpy +handsome +happy +healthy +helpful +helpless +hilarious +homeless +homely +horrible +hungry +hurt +ill +important +impossible +inexpensive +innocent +inquisitive +itchy +jealous +jittery +jolly +joyous +kind +lazy +light +lively +lonely +long +lovely +lucky +magnificent +misty +modern +motionless +muddy +mushy +mysterious +nasty +naughty +nervous +nice +nutty +obedient +obnoxious +odd +old-fashioned +open +outrageous +outstanding +panicky +perfect +plain +pleasant +poised +poor +powerful +precious +prickly +proud +putrid +puzzled +quaint +real +relieved +repulsive +rich +scary +selfish +shiny +shy +silly +sleepy +smiling +smoggy +sore +sparkling +splendid +spotless +stormy +strange +stupid +successful +super +talented +tame +tasty +tender +tense +terrible +thankful +thoughtful +thoughtless +tired +tough +troubled +ugliest +ugly +uninterested +unsightly +unusual +upset +uptight +vast +victorious +vivacious +wandering +weary +wicked +wide-eyed +wild +witty +worried +worrisome +wrong +zany +zealous \ No newline at end of file diff --git a/js/bird-words/lib/adverbs.txt b/js/bird-words/lib/adverbs.txt new file mode 100644 index 0000000..d35e5e2 --- /dev/null +++ b/js/bird-words/lib/adverbs.txt @@ -0,0 +1,140 @@ +boldly +bravely +brightly +cheerfully +deftly +devotedly +eagerly +elegantly +faithfully +fortunately +gleefully +gracefully +happily +honestly +innocently +kindly +merrily +obediently +perfectly +politely +powerfully +safely +victoriously +warmly +vivaciously +achingly +angrily +annoyingly +anxiously +badly +boastfully +dejectedly +enviously +foolishly +hopelessly +irritably +jealously +joylessly +lazily +miserably +morosely +obnoxiously +painfully +poorly +rudely +sadly +selfishly +terribly +unhappily +wearily +always +daily +eventually +finally +frequently +generally +hourly +later +never +nightly +normally +occasionally +often +rarely +regularly +seldom +sometimes +soon +still +today +tomorrow +usually +weekly +yearly +yesterday +briskly +casually +expeditiously +fleetingly +gradually +haltingly +hastily +hurriedly +immediately +instantly +languidly +lazily +leisurely +promptly +quickly +rapidly +slowly +speedily +swiftly +tediously +audibly +deafeningly +ear-splittingly +emphatically +faintly +inaudibly +loudly +noiselessly +noisily +quietly +resonantly +resoundingly +shrilly +silently +softly +soundlessly +thunderously +uproariously +vociferously +weakly +accidentally +awkwardly +blindly +coyly +crazily +cruelly +defiantly +deliberately +doubtfully +dramatically +dutifully +enormously +excitedly +hungrily +madly +mortally +mysteriously +nervously +seriously +shakily +restlessly +solemnly +sternly +unexpectedly +wildly \ No newline at end of file diff --git a/js/bird-words/lib/colors.txt b/js/bird-words/lib/colors.txt new file mode 100644 index 0000000..4dcc4d7 --- /dev/null +++ b/js/bird-words/lib/colors.txt @@ -0,0 +1,278 @@ +aliceblue +black +antiquewhite +navy +aqua +darkblue +aquamarine +mediumblue +azure +blue +beige +darkgreen +bisque +green +black +teal +blanchedalmond +darkcyan +blue +deepskyblue +blueviolet +darkturquoise +brown +mediumspringgreen +burlywood +lime +cadetblue +springgreen +chartreuse +aqua +chocolate +cyan +coral +midnightblue +cornflowerblue +dodgerblue +cornsilk +lightseagreen +crimson +forestgreen +cyan +seagreen +darkblue +darkslategray +darkcyan +limegreen +darkgoldenrod +mediumseagreen +darkgray +turquoise +darkgreen +royalblue +darkkhaki +steelblue +darkmagenta +darkslateblue +darkolivegreen +mediumturquoise +darkorange +indigo +darkorchid +darkolivegreen +darkred +cadetblue +darksalmon +cornflowerblue +darkseagreen +mediumaquamarine +darkslateblue +dimgray +darkslategray +slateblue +darkturquoise +olivedrab +darkviolet +slategray +deeppink +lightslategray +deepskyblue +mediumslateblue +dimgray +lawngreen +dodgerblue +chartreuse +firebrick +aquamarine +floralwhite +maroon +forestgreen +purple +fuchsia +olive +gainsboro +gray +ghostwhite +skyblue +gold +lightskyblue +goldenrod +blueviolet +gray +darkred +green +darkmagenta +greenyellow +saddlebrown +honeydew +darkseagreen +hotpink +lightgreen +indianred +mediumpurple +indigo +darkviolet +ivory +palegreen +khaki +darkorchid +lavender +yellowgreen +lavenderblush +sienna +lawngreen +brown +lemonchiffon +darkgray +lightblue +lightblue +lightcoral +greenyellow +lightcyan +lightsteelblue +lightgoldenrodyellow +powderblue +lightgreen +firebrick +lightgrey +darkgoldenrod +lightpink +mediumorchid +lightsalmon +rosybrown +lightseagreen +darkkhaki +lightskyblue +silver +lightslategray +mediumvioletred +lightsteelblue +indianred +lightyellow +peru +lime +chocolate +limegreen +tan +linen +lightgrey +magenta +thistle +maroon +orchid +mediumaquamarine +goldenrod +mediumblue +palevioletred +mediumorchid +crimson +mediumpurple +gainsboro +mediumseagreen +plum +mediumslateblue +burlywood +mediumspringgreen +lightcyan +mediumturquoise +lavender +mediumvioletred +darksalmon +midnightblue +violet +mintcream +palegoldenrod +mistyrose +lightcoral +moccasin +khaki +navajowhite +aliceblue +navy +honeydew +oldlace +azure +olive +wheat +olivedrab +beige +orange +whitesmoke +orangered +mintcream +orchid +ghostwhite +palegoldenrod +salmon +palegreen +sandybrown +palevioletred +antiquewhite +papayawhip +linen +peachpuff +lightgoldenrodyellow +peru +oldlace +pink +red +plum +fuchsia +powderblue +magenta +purple +deeppink +red +orangered +rosybrown +tomato +royalblue +hotpink +saddlebrown +coral +salmon +darkorange +sandybrown +lightsalmon +seagreen +orange +seashell +lightpink +sienna +pink +silver +gold +skyblue +peachpuff +slateblue +navajowhite +slategray +moccasin +snow +bisque +springgreen +mistyrose +steelblue +blanchedalmond +tan +papayawhip +teal +lavenderblush +thistle +seashell +tomato +cornsilk +turquoise +lemonchiffon +violet +floralwhite +wheat +snow +white +yellow +whitesmoke +lightyellow +yellow +ivory +yellowgreen +white \ No newline at end of file diff --git a/js/bird-words/corpus.txt b/js/bird-words/lib/corpus.txt index 55e1fb8..55e1fb8 100644 --- a/js/bird-words/corpus.txt +++ b/js/bird-words/lib/corpus.txt diff --git a/js/bird-words/lib/nouns.txt b/js/bird-words/lib/nouns.txt new file mode 100644 index 0000000..361fa85 --- /dev/null +++ b/js/bird-words/lib/nouns.txt @@ -0,0 +1,185 @@ +Actor +Gold +Painting +Advertisement +Grass +Parrot +Afternoon +Greece +Pencil +Airport +Guitar +Piano +Ambulance +Hair +Pillow +Animal +Hamburger +Pizza +Answer +Helicopter +Planet +Apple +Helmet +Plastic +Army +Holiday +Portugal +Australia +Honey +Potato +Balloon +Horse +Queen +Banana +Hospital +Quill +Battery +House +Rain +Beach +Hydrogen +Rainbow +Beard +Ice +Raincoat +Bed +Insect +Refrigerator +Belgium +Insurance +Restaurant +Boy +Iron +River +Branch +Island +Rocket +Breakfast +Jackal +Room +Brother +Jelly +Rose +Camera +Jewellery +Russia +Candle +Jordan +Sandwich +Car +Juice +School +Caravan +Kangaroo +Scooter +Carpet +King +Shampoo +Cartoon +Kitchen +Shoe +China +Kite +Soccer +Church +Knife +Spoon +Crayon +Lamp +Stone +Crowd +Lawyer +Sugar +Daughter +Leather +Sweden +Death +Library +Teacher +Denmark +Lighter +Telephone +Diamond +Lion +Television +Dinner +Lizard +Tent +Disease +Lock +Thailand +Doctor +London +Tomato +Dog +Lunch +Toothbrush +Dream +Machine +Traffic +Dress +Magazine +Train +Easter +Magician +Truck +Egg +Manchester +Uganda +Eggplant +Market +Umbrella +Egypt +Match +Van +Elephant +Microphone +Vase +Energy +Monkey +Vegetable +Engine +Morning +Vulture +England +Motorcycle +Wall +Evening +Nail +Whale +Eye +Napkin +Window +Family +Needle +Wire +Finland +Nest +Xylophone +Fish +Nigeria +Yacht +Flag +Night +Yak +Flower +Notebook +Zebra +Football +Ocean +Zoo +Forest +Oil +Garden +Fountain +Orange +Gas +France +Oxygen +Girl +Furniture +Oyster +Glass +Garage +Ghost \ No newline at end of file diff --git a/js/bird-words/lib/places.txt b/js/bird-words/lib/places.txt new file mode 100644 index 0000000..321f6ed --- /dev/null +++ b/js/bird-words/lib/places.txt @@ -0,0 +1,64 @@ +Abbey of Santa Giustina, Padua +Abbey of the Holy Spirit at Monte Morrone, Sulmona +Abbey of the Saviour, Abbadia San Salvatore +Badia Fiorentina, Florence +Basilica di San Zeno Abbey, Verona +Bobbio Abbey, Bobbio, a territorial abbacy +Camaldoli Monastery, Poppi +Casamari Abbey, Veroli +Certosa di Galluzzo, Galluzzo +Certosa di Padula, Salerno +Certosa di Pavia, Pavia +Cervara Abbey, Santa Margherita Ligure +Chiaravalle Abbey, Milan +Chiaravalle Abbey, Tolentino +Cistercian Abbey, Albino +Farfa Abbey, Fara Sabina, a territorial abbacy +Fonte Avellana, Serra Sant'Abbondio +Fossanova Abbey, Priverno +Fruttuaria, San Benigno Canavese +Grottaferrata Abbey, Grottaferrata +Hermitage of Camaldoli, Naples +La Trinità della Cava, Cava de' Tirreni +Lucedio Abbey, Turin +Marienberg Abbey, Mals +Matris Domini Monastery, Bergamo +Monastery of the Holy Saviour, Lecceto +Monte Cassino, Cassino, a territorial abbacy +Monte Oliveto Maggiore, Asciano +Nonantola Abbey, Nonantola +Novalesa Abbey, Val di Susa +Pomposa Abbey, Ferrara, a territorial abbacy +Säben Abbey, Klausen +Sacra di San Michele, Val di Susa +Sacro Convento, Assisi +San Clemente Abbey, Castiglione a Casauria +San Giorgio Monastery, Venice +San Giovanni degli Eremiti, Palermo +San Giovanni in Venere, Fossacesia +San Liberatore a Maiella, Serramonacesca +San Mercuriale, Forlì +San Miniato al Monte, Florence +San Pietro, Perugia, Perugia +San Pietro in Bovara, Bovara +San Pietro in Valle, Ferentillo +San Salvatore, Brescia, Brescia +San Vincenzo al Volturno, Castel San Vincenzo +San Vittore alle Chiuse, Genga +San Zeno (Pisa), Pisa +Sant'Anselmo, Rome +Sant'Antimo Abbey, Montalcino +Abbey of Santa Lucia, Rocca di Cambio +Santa Maria Arabona, Manopello +Santa Maria Casanova, Villa Celiera +Santa Maria del Carmine, Florence +Santa Maria della Vittoria, Scurcola Marsicana +Santi Vito e Salvo, San Salvo +Santo Spirito d'Ocre, Ocre +Santo Stefano, Bologna +Santo Stefano in Manciano, Manciano +Sassovivo Abbey, Foligno +Staffarda Abbey, Saluzzo +Tre Fontane Abbey, Rome +Vallombrosa Abbey, Reggello +Villa Magna, Anagni \ No newline at end of file diff --git a/js/bird-words/lib/verbs.txt b/js/bird-words/lib/verbs.txt new file mode 100644 index 0000000..80340f7 --- /dev/null +++ b/js/bird-words/lib/verbs.txt @@ -0,0 +1,258 @@ +Accelerate +Accommodate +Add +Accept +Achieve +Adjust +Act +Acquire +Administer +Adapt +Advise +Agree +Alert +Allocate +Allow +Analyze +Answer +Anticipate +Apologize +Appoint +Appraise +Approve +Arrange +Articulate +Ascertain +Assess +Assign +Assist +Assume +Attend +Audit +Authorize +Award +Balance +Bargain +Benefit +Blend +Boost +Brief +Build +Calculate +Call +Cancel +Capture +Care +Carry +Catalogue +Categorize +Change +Check +Choose +Classify +Clean +Clear +Close +Coach +Collaborate +Collect +Combine +Communicate +Compare +Compete +Complain +Comply +Compose +Compute +Concentrate +Conceptualize +Conclude +Conduct +Confer +Confirm +Connect +Conserve +Consider +Consolidate +Construct +Consult +Contribute +Control +Convert +Coordinate +Correct +Correspond +Counsel +Create +Critique +Cultivate +Cut +Deal +Debate +Decide +Dedicate +Define +Delegate +Deliver +Demonstrate +Depend +Design +Detail +Develop +Devise +Diagnose +Differentiate +Direct +Discover +Discuss +Display +Distribute +Document +Draft +Draw +Drive +Earn +Edit +Educate +Effect +eat +watch +love +drink +see +hate +write +hear +admire +read +smell +support +visit +touch +help +meet +taste +teach +call +entertain +learn +text +visit +invite +email +meet +deliver +fax +call +ship +mail +text +sell +ship +email +buy +lend +fax +borrow +give +mail +take +throw +ship +catch +open +lend +close +lock +give +unlock +sleep +slept +sleeping +run +ran +running +laugh +laughed +laughing +cry +cried +crying +swim +swam +swimming +dance +danced +dancing +sing +sang +singing +walk +walked +walking +jump +jumped +jumping +sit +sat +sitting +stand +stood +standing +listen +listened +listening +talk +talked +talking +think +thought +thinking +wonder +wondered +wondering +arrive +arrived +arriving +depart +departed +departing +appear +appeared +appearing +disappear +disappeared +disappearing +fall +fell +falling +rise +rose +rising +shine +shone +shining +glow +glowed +glowing +age +aged +aging/ageing +heal +healed +healing +live +lived +living +die +died +dying +exist +existed +existing +survive +survived +surviving +succeed +succeeded +succeeding \ No newline at end of file diff --git a/js/bird-words/nouns.txt b/js/bird-words/nouns.txt deleted file mode 100644 index e08fe98..0000000 --- a/js/bird-words/nouns.txt +++ /dev/null @@ -1,6 +0,0 @@ -Banana -Rocket ship -Tyrannosaurus Rex -Wheel -Lambda -Gord \ No newline at end of file diff --git a/js/bird-words/places.txt b/js/bird-words/places.txt deleted file mode 100644 index 7433bde..0000000 --- a/js/bird-words/places.txt +++ /dev/null @@ -1,4 +0,0 @@ -outer space -grey citadel -tokyo -desert canyon \ No newline at end of file |