Anki Hangman Cloze Style
For more than half a year now, it has become a habit of mine that I practice daily to resolve Anki's. That way I store the knowledge that is important to me, acquired and processed, to decide on the information I remember and consciously stop frequently googling trivial stuff like "How to format a `datetime' object?". One of the articles that guided me to this method was Michael Niesen's text entitled Augmenting Long-term Memory, which I highly recommend to you.
One of the topics of my Ankis is learning English. While reading books, I often find words that I don't know but sound interesting. Describing the flow briefly, I drop them into a list of words to remember and then run them through a simple web crawler that I wrote in Python to search for meaning, synonyms, etc. This data goes straight into my phish database via the AnkiConnect plugin in the form of a card type I created.
So far, this has been a satisfactory way to learn new vocabulary words. However, I was constantly plagued by the fact that there are many synonyms that I could fit into an answer to a given Anki, and I wanted to focus on remembering that one particular word.
I came up with the idea of implementing a custom type of cloze based on the principle of the hangman game. In short, each letter should be replaced by a '_' character, which would tell me how many letters the word I have to guess has. On top of that, I also wanted to get some kind of hint in the form of one or a couple of letters, which would limit the spread of matching words.
The wonderful thing is that Anki is fully programmable. So I wrote a simple script to hide the letters of specific fields shown below:
Well, it works beautifully! Is it a better way to learn than the previous version of the card? I will conclude over time. For now, I'm sharing this little hack with you, and for those who are not yet using Anki, I warmly invite you to do so, as it makes it very easy to learn and absorb all kinds of knowledge. Finishing this post, I am sharing the piece of script I showed above.
<script>
function hangman_cloze(id, uncover_percentage) {
let text = document.getElementById(id).innerHTML;
let result = "";
let max_uncovered = text.length * uncover_percentage
let uncovered = 0
for (let i = 0; i < text.length; i++) {
let letter = text.charAt(i)
if (letter == ',' | letter == ' ') {
result += letter
} else if (Math.random() < uncover_percentage & uncovered < max_uncovered) {
result += letter;
uncovered += 1;
} else {
result += '_'
}
}
document.getElementById(id).innerHTML = result;
}
hangman_cloze('word', 0.25)
hangman_cloze('synonyms', 0.25)
</script>