Skip to content
Extraits de code Groupes Projets
Valider 90112d8c rédigé par Adrien NUNES's avatar Adrien NUNES
Parcourir les fichiers

<want> small fix

parent 72ae69c7
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -14,17 +14,12 @@ class InformeMoi{ ...@@ -14,17 +14,12 @@ class InformeMoi{
fillAllRandomObject(sentence, regularExpr, randomMethode){ fillAllRandomObject(sentence, regularExpr, randomMethode){
const matches = sentence.matchAll(regularExpr); const matches = sentence.matchAll(regularExpr);
const size = matches.length;
let objectString = ""; let objectString = "";
let newSentence = sentence; let newSentence = sentence;
for(let match of matches){ for(let match of matches){
objectString = randomMethode(); objectString = randomMethode();
newSentence = newSentence.replace(match, objectString); newSentence = newSentence.replace(match, objectString);
} }
if(size === 1 && regularExpr === this.actorRE){
const want = objectString.startsWith("Les ") ? "veulent" : "veut";
newSentence = newSentence.remplace(match, want );
}
return newSentence; return newSentence;
} }
...@@ -37,7 +32,7 @@ class InformeMoi{ ...@@ -37,7 +32,7 @@ class InformeMoi{
sentence = this.fillAllRandomObject(sentence, this.reasonRE, complotDB.getRandomReason.bind(complotDB)); sentence = this.fillAllRandomObject(sentence, this.reasonRE, complotDB.getRandomReason.bind(complotDB));
sentence = this.fillAllRandomObject(sentence, this.sourceRE, complotDB.getRandomSource.bind(complotDB)); sentence = this.fillAllRandomObject(sentence, this.sourceRE, complotDB.getRandomSource.bind(complotDB));
sentence.replaceAll(this.wantRE, 'veut'); /**Todo, change */ sentence = sentence.replaceAll(this.wantRE, 'veut'); /**Todo, change */
return sentence; return sentence;
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter