Reverse cards in random mode

Hey, I imported a lot of cards from memrise however they are all being displayed from Native language into the Target Language, ie:

English - French

I would like to learn other way around but randomly, thus Anki would show cards to repeat in the way of:
English - French, French - English and so on like it is on memrise website.

I know I can force them other way around but it is pointless to repeat the whole deck (same words) again but from the other side.
Is there really no such option to randomize it and repeat flashcards from both sides without the need to create a separate template and repeat again the same words?

Right now you have English → French, adjusting the card template to add French → English seems the natural thing to do. You can change the display order in the deck settings then.

But I don’t want to adjust card types. I’d like the app to randomly switch between English and French itself.
If I have 100 words to learn from English to French all of them are showed from English to French.
To have them reversed I would need to repeat all the same words again which is not what I want.

Can’t it just swap automatically front\back?

What you want is to add a card template. Basically, now, for each note (datatype which contains fields) only produces a single card (what you actually review). Which means if you have a note with a French field, and an English field, you can only have French → English or English → French at the time. To do what you want, you need each note to produce two cards: one French → English and one the other way around. You could do that by hand, but since this is such a common pattern there is a premade Basic (reverse) note type that already does this for you. Simply go in the browser and change the note type to that one.

I used a basic one with reverse. It created 2 cards for a one word. This means I will have to learn it twice which is not the point :stuck_out_tongue:
In memrise you learn a word only once. Then you repeat it randomly. If in your language, a word XXX means ZZZ then you can be asked (in the repetition mode) by the algorithm in two ways:

XXX - ???
ZZZ - ???

But you learn the word once, Anki doubles amount of cards, thus learning stack amount is higher than it should be.

You can easily adjust the options for this deck to keep the burden of reviews low.

Yes but it won’t work as desired. So I presume there is no easy, workable solution for that what I want… Learning 5000 words again is out of option, adjusting options manually is also a ton of burden.
A single option to randomize flip and front in Anki’s engine would solve this.
During a review engine would choose based on random choice to show either front or back and so forth…

This seems doable with javascript.
(disclaimer: I cannot code. But maybe someone else can code this)

E.g.
You could use Math.round(Math.random()) (?) to randomly generate either 0 or 1 every time a card is loaded; then execute a piece of code depending on which of the two has been generated.

  • if 0 is picked, then only {{English}} would be shown in the front
  • if 1 is picked instead, then only {{French}} would be shown in the front
  • either 0 or 1 is picked, both field will be shown after the card is flipped

Or you could also do something similar using this addon
Additional Card Fields (Fork for 2.1) - AnkiWeb.
E.g. you could use {{info-Ivl:}} or {{info-Reviews:}} to generate a (sort of) random number, then execute a piece of code according to the result, e.g. depending if said number is odd or even

An interesting idea, but my programming skills are close to none though :joy: I even didn’t know Anki allowed JS

This seems to work for me:
Try adding this to the front template of your cards:

<span id="French">{{French}}</span>
<span id="English">{{English}}</span>

(if your fields are not called “French” and/or “English”, change {{…}} accordingly)

This to the bottom of the front template:

<script>
var x = Math.round(Math.random())

//check if the number is even
if (x % 2 == 0) {
    document.getElementById("French").className= "hide"; 
}

// if the number is odd
else {
    document.getElementById("English").className= "hide";  
}
</script>

And this to the styling section:

.hide {display:none}

This is just an example.
If this code does not work for you and/or you want help on how to style the cards etc. please share your cards’ template (front, back, styling section)

(EDIT: using RNG, e.g. via Math.round(Math.random()) has some problems, mainly that it is a bit too random.
E.g., if you’re studying a card and English → French is displayed, if you click on “again” you won’t be assured that the next time the card appears it will still be displayed as English → French and not as French → English, as both have a 50% probability to happen each time the card is loaded)

Wauw, it works!

It works as it should, great! I apply it for all my languages, however I wonder if I can adjust it this way - normally when I am asked by default the front card is:

FRONT:
Polish

BACK
Polish
Dutch

If a number is different, then it goes almost correctly:

FRONT:
Dutch

BACK
Polish
Dutch

I wonder if I can force this look for the cards where Dutch is chosen:
BACK
Dutch
Polish

So Dutch above, Polish bottom. This will provide a consistent experience for eyes, they will not have to jump top\bottom all the time.

tl;dr - a pic should explain it better:

Not sure if it can be done by script though. Here is my simpe card, I removed synonyms to keep it clean:

Front:

<span id="Polish">{{Polish}}</span>
<span id="Dutch">{{Dutch}}</span>


<script>
var x = Math.round(Math.random())

//check if the number is even
if (x % 2 == 0) {
    document.getElementById("Dutch").className= "hide"; 
}

// if the number is odd
else {
    document.getElementById("Polish").className= "hide";  
}
</script>

Back:

<span id="Polish">{{Polish}}</span>
<hr id="answer" />
<span id="Dutch">{{Dutch}}</span>

Maybe you could try something like this:

Front:

<span id="Polish">{{Polish}}</span><span id="D→P">(?)</span>
<hr>
<span id="Dutch">{{Dutch}}</span><span id="P→D">(?)</span>

<script>
var x = {{info-Ivl:}}

//check if the number is even
if (x % 2 == 0) {
    document.getElementById("Polish").className= "hide";  
    document.getElementById("P→D").className= "hide"; 
}

// if the number is odd
else {
    document.getElementById("Dutch").className= "hide"; 
    document.getElementById("D→P").className= "hide"; 
}
</script>

Back:

{{Polish}}
<hr>
{{Dutch}}

Styling:

#D→P {font-weight:bold; color:#00ff7f}
#P→D {font-weight:bold; color:#00ff7f}
.hide {display:none}

With this template Polish would still be on top on both the front and the back of the card, and viceversa, but it should look a bit more orderly.
Notice that I replaced Math.round(Math.random()) with {{info:Ivl:}}. I did so because Math.round(Math.random()) behaved weirdly now that two functions need to be executed at the same time.
This also means two things:

  • you need the aforementioned addon to make {{info:Ivl:}} work; this also means this card template will only work on Anki Desktop
  • the choice between which of the two languages should be displayed on the front of the card is not 100% random anymore. It instead dipends on the interval of the current card. This can be both a good and a bad thing (e.g. it fixes the problem I talked about in the last post)

You could also keep Math.round(Math.random()), but you would then need to remove <span id="P→D">(?)</span>, document.getElementById("D→P").className= "hide"; etc. from the front template and the styling section

Keep in mind that what you are doing is terribly against how Ank is supposed to work, and that is a really good reason for it! If Anki wants you to make two cards for the two directions, instead of a single one that shows randomly a side or the other, it’s not just for the sake of increasing your browser list. It’s so Anki can track individually your progress on each direction.

You should see no difference in having a single card that shows both directions, or having two cards, each for one direction, but Anki does, so I recommend you stick to that.
Also, you don’t need to re-learn 5000 cards if you think you already know them: you can manually set their learning state to their counterparts, so that it’s really just like if you have a single card.

3 Likes

It works flawlessly. I decided to keep Math.round(Math.random()) and go as it is. I tested it for 1 deck and it seems to be working as desired. I am going to add some more fields back like synonyms and stylize it a bit :slight_smile:
I haven’t realized Anki supported Javascript, is there a way to distinguish cards which are being repeated from those which you learn?
I would keep a normal mode (single language) when learning new cards and the code we discuss here when repeating words.
Is there a keyword which could tell anki to execute the code only in repeat mode? It is not a big deal, not at all, I am just curious.
I already spotted that I am not so good anymore when I repeat words from the other side :smiley:

Perhaps it is not as it was supposed to be, I came from memrise where this model worked quite good I must say.
Randomization, learning from both sides is something refreshing - I am aware I could just set them reverse but still it wasn’t how I’d like it to be - even if I already know more or less 5000 and more flashcards. I have already deleted all my stats and I scheduled randomly all 7000 flashcards to be displayed again as new ones within 3 months :slight_smile:

Maybe with the “Additional Card Fields” addon, as it allows for the additional field {{info-New?:}}.
As I said, I’m not a coder, so I don’t really know how it could be implemented (I tried without much success), but in theory it should be doable

It goes quite well, I am happy of the results however I struggle with those intervals of Anki. I know it is the repetition system but the difference between a “poor” answer and a “good” one is sometimes ridiculous.
I had 15 min if I pressed “poor” and 1.2 months if “good”. This is ridiculous, really. Why are default settings of this spaced repeating system so weird?
For me example 15 min was too short and I would surely forget a word in 1.2 months. I am tweaking it to be more strict than this though.

Maybe you were studying overdue cards? Sometimes my Anki behaves likes that when I study cards that were due a long time ago

Btw, I suggest watching this video if you haven’t yet: Guide to Anki Intervals and Learning Steps - YouTube

These intervals would make sense, if you followed how Anki is supposed to work. Anki proposes longer and longer intervals when you keep succeeding at remembering a single card because it assume that card contains a single information you are trying to memorize (not two), and because it is based on the work of cognitive researchers that have shown this is an efficient way to memorize (ie. you won’t “surely forget” something even if the intervals get bigger). The parameters Anki uses to generate these intervals can be tweaked to achieve what is best for you, but you can’t modify the core Anki algorithm.