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 1/2] 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 + ":"; From 69c32a4e750e5cb0ade66ef0c6b39ed19f4f964e Mon Sep 17 00:00:00 2001 From: Vuong BUI <37221772+vuong-buihv@users.noreply.github.com> Date: Fri, 27 Nov 2020 21:51:56 +0100 Subject: [PATCH 2/2] Removed {} and [] from the punctuation mode --- src/js/script.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/js/script.js b/src/js/script.js index ed5efc594..7b9758415 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -740,20 +740,6 @@ function punctuateWord(previousWord, currentWord, index, maxindex) { ) { //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 + ":";