(pronouns) in any pronouns, do not use a pronoun in a example sentence if it has not all required morphemes

This commit is contained in:
Valentyne Stigloher 2023-11-17 17:02:35 +01:00
parent 773976f0b6
commit 41debf31a7

View File

@ -35,7 +35,7 @@
<ul>
<li v-for="example in examples" v-if="!example.comprehensive || comprehensive" class="my-1">
<Example :example="example" :pronoun="randomPronoun()" link/>
<Example :example="example" :pronoun="randomPronounForExample(example)" link/>
</li>
</ul>
</section>
@ -103,9 +103,10 @@
}
},
methods: {
randomPronoun() {
const keys = Object.keys(this.pronounsChoice);
return this.pronounsChoice[keys[keys.length * Math.random() << 0]];
randomPronounForExample(example) {
const suitablePronouns = Object.values(this.pronounsChoice)
.filter(pronoun => example.requiredMorphemesPresent(pronoun));
return suitablePronouns[suitablePronouns.length * Math.random() << 0];
},
}
}