TBS1996 / speki

flashcard app in your terminal
GNU General Public License v2.0
496 stars 18 forks source link

Question about the Anki learning scheme #7

Open Szybet opened 2 years ago

Szybet commented 2 years ago

Hello

How does this app support the Anki database, learning scheme? is it full? what resources did you use to reverse engineer it?

im the developer of sanki and im interested to develop this in my own app

Maybe we could write a library in rust to handle Anki backend?

Im open for discussion and collaboration

TBS1996 commented 2 years ago

Hello!

I'm not sure what you mean with it being full.
For reverse engineering it i used this page: https://github.com/ankidroid/Anki-Android/wiki/Database-Structure
All the code related to parsing the database can be found at src/utils/widgets/load_cards.rs, so feel free to copy as you please, it's FOSS after all. the TLDR is that I made structs representing the various tables with the fields that are relevant, used hashmaps to connect the IDs that refer to each other, and regex to parse the various text-fields! The code isnt that clean atm, making it work was a frustrating experience enough x)

About the library part, while I'm a bit busy developing this and looking for a rust job, I suppose it wouldn't be that hard since that single file does most what you need already. Anyway, you could read through it and tell me your thoughts

Szybet commented 2 years ago

Well as I see you don't use the Anki learning scheme ( repetition algorithm )? Point me to the code if im wrong. This is the part that im also missing in my app.

I also don't have time for the library right now. The idea I have is if one of two of us starts to work on the full support for Anki learning scheme, then to do this as a rust crate, for easier use in other programs / easier to contribute

TBS1996 commented 2 years ago

ah, I thought you were only referring to the database. About the repetition algorithm, I didn't base it on anything existing, I just made my own super basic version. I'm planning to use machine learning eventually so I'm not going to spend time hand-tuning the algorithm just to scrap it away later anyway. You can find the algorithm in src/utils/interval.rs

so about the library, you mean basically an sm-2 algorithm?

Szybet commented 2 years ago

Thats what i thought, thats what im also planning... I would like to avoid that and make full Anki support

The one that Anki uses, with integration with the anki database oob, yes

vimist commented 2 years ago

I realise that neither Speki nor Sanki are written in Python, but I was looking to create terminal based spaced repetition software a while ago (which I never got around to) and came across a library called ebisu that at first glance looked promising. Just thought I'd leave a note here in case it's of any use to either of you.