Merge pull request #627 from vuong-buihv/punctuation-mode

Punctuation mode updated
This commit is contained in:
Jack 2020-11-29 20:47:23 +00:00 committed by GitHub
commit 9f35a59a08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -726,6 +726,20 @@ 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) {
//1% chance to add a colon
word = word + ":";