From eafc22c36e5a9688fa4901ed284876e72c08644f Mon Sep 17 00:00:00 2001 From: Vuong BUI <37221772+vuong-buihv@users.noreply.github.com> Date: Wed, 25 Nov 2020 20:50:45 +0100 Subject: [PATCH] Punctuation mode updated * single quotes '' * parentheses () * braces {} * brackets [] --- src/js/script.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/js/script.js b/src/js/script.js index 3ae1a8b29..ed5efc594 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -726,6 +726,34 @@ function punctuateWord(previousWord, currentWord, index, maxindex) { ) { //1% chance to add quotes word = `"${word}"`; + } else if ( + Math.random() < 0.01 && + getLastChar(previousWord) != "," && + getLastChar(previousWord) != "." + ) { + //1% chance to add single quotes + word = `'${word}'`; + } else if ( + Math.random() < 0.01 && + getLastChar(previousWord) != "," && + getLastChar(previousWord) != "." + ) { + //1% chance to add parentheses + word = `(${word})`; + } else if ( + Math.random() < 0.01 && + getLastChar(previousWord) != "," && + getLastChar(previousWord) != "." + ) { + //1% chance to add braces + word = `{${word}}`; + } else if ( + Math.random() < 0.01 && + getLastChar(previousWord) != "," && + getLastChar(previousWord) != "." + ) { + //1% chance to add brackets + word = `[${word}]`; } else if (Math.random() < 0.01) { //1% chance to add a colon word = word + ":";