about summary refs log tree commit diff stats
path: root/js/bird-words
diff options
context:
space:
mode:
Diffstat (limited to 'js/bird-words')
-rw-r--r--js/bird-words/beak.js13
-rw-r--r--js/bird-words/script.txt1
2 files changed, 8 insertions, 6 deletions
diff --git a/js/bird-words/beak.js b/js/bird-words/beak.js
index a87bc0d..eca0067 100644
--- a/js/bird-words/beak.js
+++ b/js/bird-words/beak.js
@@ -72,10 +72,11 @@ const fillGaps = (script, nouns, adjectives, places, markovChain, pairs) => {
     }).join('');
 };
 
-const script = 'The @NOUN@ of @ADJECTIVE@ @NOUN@ was found in @PLACE@ where there was a partial inscription that read, @MARKOV 22@';
+const scriptFile = process.argv[2];
 
-// example of how to use fillGaps to generate a story
-console.log(wrap(prettyItUp(fillGaps(script, nouns, adjectives, places, markovChain, pairs)), 40));
-
-// example of how to just use markov chain to generate a story
-console.log(wrap(prettyItUp(story), 40));
\ No newline at end of file
+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));
+}
\ No newline at end of file
diff --git a/js/bird-words/script.txt b/js/bird-words/script.txt
new file mode 100644
index 0000000..e3e4105
--- /dev/null
+++ b/js/bird-words/script.txt
@@ -0,0 +1 @@
+The @NOUN@ of @ADJECTIVE@ @NOUN@ was found in @PLACE@ where there was a partial inscription that read, @MARKOV 22@
\ No newline at end of file