Back

For those who can't help but "cheat" on sentence cards.

#1
The purpose of sentence cards when studying vocabulary is to see the word in context. However, I've noticed that sometimes the context can allow me to "cheat", and to recall the answer to the card while skipping over the actual prompt that should be triggering it.

For example, I may have the following card meant to test the word 運ぶ:
Front: 病人は救急車で病院へ急いで運ばれた.
Back: はこぶ - to carry; to transport; to move; to convey

When studying a card like this, I tend to recognize the card immediately by the first few words. I then know the answer is "はこぶ - carry" before I even reach the point in the sentence where "運ぶ" appears. Studying in this way reinforces the wrong connection. It reinforces the [病人は救... - はこぶ] connection, not the [運ぶ - はこぶ] connection. The result of this is that seeing 運ぶ in another context does not trigger はこぶ to come tom mind.

I thought it would be a good idea to have several example sentences for a word to allow me to see the word in various contexts. I could create a card for each sentence, but this would mean that the given vocab word would appear too frequently while reviewing.

So I've written a small bit of javascript that I could place on a card with multiple example sentence fields that would display one of them at random on the front of the card. I thought others might find this useful.

To make the code work, place each example sentence in a div on the front of the card with the id ex#, where # is a number. The div should have its display set to none:

Code:
<div id="ex1" style="display:none">
    {{example 1_jp}}
</div>
Do this for all example fields.
In this example I have a total of 15 example fields on each note, so I set numExFields below equal to 15. You would set it to however many example fields you want on your cards.
The code counts all non-empty example fields, picks a random number up to that count, and shows the example corresponding to that number (this means you don't need to have the same number of examples for each card).
One note: the code breaks if you skip fields. That is to say, don't have an example 1 and an example 3, without an example 2.

Code:
<script>
        var numExFields = 15;
    var exCount = 0;
    for(var i=1;i<=numExFields;i++){
        var divid = "ex"+i;
        var divText =document.getElementById(divid).innerText.trim();
        if(divText!=""){
            exCount += 1;}
        else{break;}};
    var x = Math.floor(exCount*Math.random())+1;
    var divToShowId = "ex"+x;
    divToShow = document.getElementById(divToShowId);
    divToShow.style.display = 'block';
</script>
One downside to this approach is that since Anki reloads the card when you click "Show Answer", the {{FrontSide}} field will likely display a different sentence after you show the answer. So you may want to include all of the example sentences on the back of the card.

Although I started this post talking about vocab, I think this method is even more useful for grammar points, since they often cannot be studied at all without context.

Also, you can combine this with cloze deletions as well.

this forum has been very helpful to me, I thought I would offer this small bit back. I hope somebody finds it useful.
Reply