From 619383d6bcf717444d042b099e7cc534e55a96b8 Mon Sep 17 00:00:00 2001 From: elioat Date: Sat, 30 Dec 2023 16:32:09 -0500 Subject: * --- js/bird-words/beak.js | 13 +++++++------ js/bird-words/script.txt | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 js/bird-words/script.txt (limited to 'js') 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 -- cgit 1.4.1-2-gfad0