fixed : or ; appearing after each other

This commit is contained in:
Jack 2021-07-28 23:22:34 +01:00
parent a2ff129ad1
commit c8f2db689a

View file

@ -325,7 +325,13 @@ export function punctuateWord(previousWord, currentWord, index, maxindex) {
} else {
word = `(${word})`;
}
} else if (Math.random() < 0.013) {
} else if (
Math.random() < 0.013 &&
Misc.getLastChar(previousWord) != "," &&
Misc.getLastChar(previousWord) != "." &&
Misc.getLastChar(previousWord) != ";" &&
Misc.getLastChar(previousWord) != ":"
) {
if (currentLanguage == "french") {
word = ":";
} else if (currentLanguage == "greek") {
@ -344,7 +350,8 @@ export function punctuateWord(previousWord, currentWord, index, maxindex) {
Math.random() < 0.015 &&
Misc.getLastChar(previousWord) != "," &&
Misc.getLastChar(previousWord) != "." &&
Misc.getLastChar(previousWord) != ";"
Misc.getLastChar(previousWord) != ";" &&
Misc.getLastChar(previousWord) != ":"
) {
if (currentLanguage == "french") {
word = ";";