Hello,
I use Anki to learn languages. I write the word I want to memorize on the front, and on the back I write its translation, as well as an illustrative contextual sentence containing the word + an audio file if possible.
I have been noticing more and more that I sometimes forget the exact meaning of the word, yet I remember the illustrative sentence at the back of the card.
To avoid this, I’d like to know if it’s possible to have several such illustrative sentences (3 or 4) that could be displayed alternatively, so as not to always have the same sentence being shown to me every time I work on a given card. So the first time a card is shown to me, I get sentence A, the 2nd time I am shown sentence B, the 3rd time I see sentence C, and so on.
Is there any way to do this?
Thanks!
You could use Javascript for that matter. The good news is that javascript code will also work in mobile devices. What is even better is to randomize the order, so there is no sequential order of feeding a sentence to the card. If you provide your note field names I’d be able to write it down for you.
Thank you so much Guillem, I am an absolute ignorant in coding so your help would be greatly appreciated!
To be honest I’m not even sure what you are asking of me (note field names), probably because my interface is in French. Here is an example of what the “field” («champ») looks like :
Is this what you need?
Thanks!
I see you only have Front and Back i.e. Recto and Retour. Having extra fields one for each sentence would greatly simplify the implementation. I am assuming in the cyrillic text there are several sentences? It seems there is only one long sentence based on punctuation marks.
Thank you, yes there is only one big sentence in this example.
In other cards I do insert several sentences which all contain the target-word, but I just write them one after the other. Let me explore the issue of extra fields in the manual, because I didn’t even know this possibility existed. Thanks for your help and patience!
That is, and in some cards you will have up to 3 sentences, right?
That’s correct. I could do more but I’m afraid it might become too time-consuming… I already have cards with 3 sentences in the same Retour field so I could just copy-paste them in the new additional fields I have just created… I guess?
Yes. OK, then for the shake of the example I will add random sentences. I will recreate your custom note type an try the javascript code there, once done I’ll paste it here. I’ll do it at a latter time today.
That would be amazing. Thank you very much!
This code randomizes all the non empty senteces available:
Front:
{{Recto}}
Back:
{{FrontSide}}
<hr id=answer>
{{Retour}}
<span id="phrase"></span>
<script>
var sentences = ["{{Phrase1}}","{{Phrase2}}","{{Phrase3}}"]
sentences = sentences.filter(item => item);
var howmany = sentences.length;
var r = Math.floor(Math.random() * howmany);
var selected = sentences[r];
document.getElementById("phrase").innerHTML = selected;
</script>
1 Like
Wow thank you Guillem! I know it’s silly but I’m not even sure where to insert the code. Should it go here?:
Yes, first tab is frontside, second tab is backside.
Thank you Guillem!
I’m trying it out now, and I do get only one sentence each time. However there is an “undefined” line under it, like so: