about summary refs log tree commit diff stats
path: root/js
diff options
context:
space:
mode:
authorelioat <hi@eli.li>2023-12-30 16:17:09 -0500
committerelioat <hi@eli.li>2023-12-30 16:17:09 -0500
commitc65877874732ba263f7dfc5eec6368af2a85cc41 (patch)
treeb1da24acc70c7f8e9a4e86335cfe33c4a9f1c2d1 /js
parent915c9dd4d52105180a6a18761917db65c975a309 (diff)
downloadtour-c65877874732ba263f7dfc5eec6368af2a85cc41.tar.gz
*
Diffstat (limited to 'js')
-rw-r--r--js/bird-words/README.md48
1 files changed, 6 insertions, 42 deletions
diff --git a/js/bird-words/README.md b/js/bird-words/README.md
index 81940d7..b20e9ba 100644
--- a/js/bird-words/README.md
+++ b/js/bird-words/README.md
@@ -1,48 +1,12 @@
 # Beak
 
-Beak is a Markov chain generator. 
+Beak is a Markov chain generator and text generator. 
 
-The corpus is tailored for a specific vibe.
+You can provide beak with a script in the following format and it will generate a story, filling in the gaps you've left: 
 
-In the future I would like to modify this such that I am able to present a script with gaps in it and for the output to fill in those gaps: 
-
-```
-The @NOUN@ of @ADJECTIVE@ @NOUN@ is known for @MARKOV 13@
-```
-
-Where `@NOUN@` would select a word from a noun word list at random, `@ADJECTIVE@`, likewise, and `@MARKOV 13@` wold generate a 13 pair long Markov chain to insert at that point.
-
-That'll be something like...
-
-```js
-let nouns = fs.readFileSync('nouns.txt', 'utf8').split('\n');
-let adjectives = fs.readFileSync('adjectives.txt', 'utf8').split('\n');
-
-function fillGaps(script) {
-    let parts = script.split('@');
-    for (let i = 0; i < parts.length; i++) {
-        if (parts[i].startsWith('NOUN')) {
-            parts[i] = nouns[Math.floor(Math.random() * nouns.length)];
-        } else if (parts[i].startsWith('ADJECTIVE')) {
-            parts[i] = adjectives[Math.floor(Math.random() * adjectives.length)];
-        } else if (parts[i].startsWith('MARKOV')) {
-            let length = parseInt(parts[i].split(' ')[1]);
-            let chain = '';
-            let pair = pairs[Math.floor(Math.random() * pairs.length)];
-            for (let j = 0; j < length; j++) {
-                let nextWords = markovChain.get(pair);
-                let nextWord = nextWords[Math.floor(Math.random() * nextWords.length)];
-                chain += ' ' + nextWord;
-                pair = pair.split(' ')[1] + ' ' + nextWord;
-            }
-            parts[i] = chain;
-        }
-    }
-    return parts.join('');
-}
-
-let script = 'The @NOUN@ of @ADJECTIVE@ @NOUN@ is known for @MARKOV 13@';
-console.log(fillGaps(script));
+```plaintext
+This is a @NOUN@ with @ADJECTIVE@ kind of @EMOTION@ about @PLACE@ because once it @MARKOV 15@
 ```
+Not all gap types are yet supported. Those are being added now.
 
-But this remains totally untested at this time.
\ No newline at end of file
+The number in the `@MARKOV 15@` indicates that the snippet of text should be (about) 15 elements long.
\ No newline at end of file