You can find the app and code here on GitHub. It’s still far from perfect and I am working on improvements and more features.
What is Anki
Effective learning is a huge topic in itself. There are many methods and approaches. When it comes to memorizing things, spaced repetition is a very popular and effective method.
Memorization of some kind is always necessary, but it really depends on what exactly are you learning.
For example, learning mathematics or programming requires little memorization (syntax, which you can always look up), but it needs a lot of training to develop understanding.
Language learning requires a lot more memorization. You first need to have a large enough vocabulary before you can start using it.
I’m currently learning German language and one of the best tools I have come to is Anki. I just wish I already had it during high school.
This post is not about Anki, so just in short, it’s a tool that uses spaced repetition and flashcards to help you move things from short-term memory into long-term memory.
You can either download premade set of cards, or approach which is way more effective and which I prefer is to create cards yourself. Creating effective cards is another skill in itself, about which I may make another post later, but the downside is it can get pretty time-consuming.
This is where automation comes very, very handy.
My process of creating cards usually looks as follows:
- Look up word/verb
- Create different kinds of cards (clozed, regular, type-in)
- Each card with an example sentence, word translation, explanations, pictures, audio, and more
- Repeat
If you ever worked with Anki, you can image how time-consuming creating different kinds of cards each with different values and style can be.
But as many other tedious and repeating activities, it can be broken down into few clear steps (an algorithm) and each of the steps can be automated.
The problem
As I mentioned, I prefer to create my own cards. Though this is way more effective, it is also a lot more time-consuming.
95% of the time the steps to create a card are the same.
- Open the web-browser & dictionary
- look up word, look up translation
- open new card
- add word, translation (use colors for readability)
- add sound
- use the web-browser again, search for and add picture
- use the web-browser again, search for and add example sentences
- repeat for the same word, but with different card type
As you can see, these are manual steps that take a lot of time, but as soon as you catch yourself doing something over and over you should stop and think - maybe there is a way to automate this process?
And since I’m improving my skills in Python (which is actually an ideal tool for automation of any kind), this might be an excellent learning challenge.
So I started researching the basics of automation.
Breaking down the problem
What I really like about programming is that it’s basically a problem solving.
Good problem solving is a skill that can be developed and improved.
What you are basically trying to do is take the problem and break it down into smaller steps. Like my card creation process.
Then you want to look at each step and see if you can either break it down further, or you already have a potential solution in mind for this particular step.
This way even at first-glance unsolvable problems will suddenly become more manageable.
Finding solutions
So I had my problem broken down and started looking for solutions.
Now my automation is not full at the moment, I will still need to implement the second, larger part, which might be taking the exported data (that is, words, translations, images, example sentences etc.) and create a special kind of card for each input.
But I managed to automate the tedious work of looking up words, translations, sentences, images and exporting them (for now) only as a .txt file, from which I can directly copy text and start making my cards.
Not full automation yet, but already a pretty nice time saver.
Automation
My app is currently working as a CLI, and recently I modularized the code in order to learn and apply some useful principles (such as Easier to change - DRY, modularization). Each module is, I believe, pretty self-explanatory in what it does.
The main app.py
looks as follows:
|
|
It defaults to a word look-up, if you are searching for a verb you have to specify a flag -t verb
as in type == verb
.
I had to separate it as I kept encountering issues, because words and verbs were outputted differently (I’m scraping the dictionary as they didn’t have an API) so I am handling and parsing the output differently for each.
There were and still are many issues, but I’d say 80% of the time the output is correct.
The project is still open, and I will keep updating it. I can already think of some refactoring that would help, and also some new features.