Great, thanks for reporting back! Peter
On Sun, 26 Apr 2020, 16:55 Alejandro Forero Cuervo, <[email protected]> wrote: > I figured I'd post an update in case someone else finds this useful. > Obviously, it's possible I'm doing something stupid, but ... it seems to be > working. :-) > > The script I'm using is here: > https://github.com/alefore/edge/blob/master/src/clozes.py. It reads my > entire set of Markdown files and outputs a cards.xml file with cloze > deletion facts+cards. I wrote a bit about it in: > https://github.com/alefore/weblog/blob/master/zettelkasten.md#spaced-repetition-and-notes > > At first, I tried to use the libmnemosyne API but figuring out how to > update previously created cards (e.g., if the index property of a cloze > deletion card changes) seemed tricky. So I opted for using the *.cards > approach. I'm generating the IDs of the facts/cards in a ~stable manner > (fact IDs are a function of the path where they were found, cloze deletion > card IDs are a function of the path + hash of the answer). > > Thank you once again, Peter, for your help! The suggestion to just > generate *.cards files was super useful! <3 > > On Fri, Apr 24, 2020 at 6:27 PM Alejandro Forero Cuervo <[email protected]> > wrote: > >> Awesome, thank you very much for your help, Peter! >> >> Looks easy enough. I guess I'll probably use the Python API, that example >> you sent me looks pretty straightforward. Once I've figured out the details >> (e.g., how to generate IDs and such), I'll probably update this thread with >> the results, in case others find it useful. >> >> Thanks again! >> >> On Fri, Apr 24, 2020 at 1:31 PM <[email protected]> wrote: >> >>> Hi, >>> >>> >>> >>> Glad you like Mnemosyne! >>> >>> >>> >>> There’s two options to achieve what you want: >>> >>> >>> >>> One is to use the Python API to create, retrieve and edit cards (see >>> https://github.com/mnemosyne-proj/mnemosyne/tree/master/mnemosyne/example_scripts >>> for examples). I would not recommend directly approaching the sqlite >>> database, as that will result in the sync algorithm not picking up any >>> changes (that’s what all the logging statements are for). >>> >>> >>> >>> Alternatively, you can try to manually create a *.card files instead of >>> a text file, as these contain ids so that later on you can import them >>> again to result in an update. >>> >>> >>> >>> >>> https://github.com/mnemosyne-proj/mnemosyne/blob/master/mnemosyne/libmnemosyne/file_formats/mnemosyne2_cards.py >>> >>> >>> >>> A *.cards file is basically a zipfile. Just look into one to get a >>> feeling for how it is put together. >>> >>> >>> >>> Good luck! >>> >>> >>> >>> Peter >>> >>> >>> >>> *From:* [email protected] < >>> [email protected]> *On Behalf Of *Alejandro Forero >>> Cuervo >>> *Sent:* 23 April 2020 21:52 >>> *To:* [email protected] >>> *Subject:* [mnemosyne-proj-users] Updating previously imported cards? >>> >>> >>> >>> Hello, >>> >>> I'm super happy with Mnemosyne, which I've been using since 2014. I >>> currently have 8.1k cards. I find it very useful! I'm a huge fan. :-) >>> >>> I'm beginning to generate cards from my set of notes (my Zettelkasten, >>> as described in >>> https://github.com/alefore/weblog/blob/master/zettelkasten.md#spaced-repetition-and-notes) >>> that I import into Mnemosyne. I consider my notes my canonical source of >>> information and I just want to be able to import them into Mnemosyne. I >>> have been quite successfully generating and importing tab separated files. >>> It works great! >>> >>> I was wondering if there's a way to update previously imported cards >>> (without losing their state)? When I update my notes with additional >>> information, I would love for their associated cards to be updated. >>> >>> For example, I have a note like this (simplifying somewhat): >>> >>> Paul Klee timeline: >>> * 1879: Born in Münchenbuchsee, Switzerland. >>> * 1940: Died. >>> >>> >>> >>> zkcloze("1940", "year"); >>> >>> zkclose("Switzerland", "Country"); >>> zkcloze("1879", "year"); >>> >>> >>> The last 3 lines basically specify that 3 flashcards should be >>> generated, using cloze deletion, replacing specific tokens (e.g., "1879") >>> with a hint ("___year___"), such as: >>> >>> Paul Klee timeline: <ul><li><b>___year___</b>: Born in Münchenbuchsee, >>> Switzerland</li><li>1940: Died.</li></ul>\t Paul Klee timeline: >>> <ul><li><b>1879</b>: Born in Münchenbuchsee, Switzerland</li><li>1940: >>> Died.</li></ul> >>> >>> >>> So far so good. This works great! >>> >>> >>> >>> However, if I edit the note in the future (perhaps I register the fact >>> that he got married in 1906; or maybe I discover that I had the city >>> wrong), I would like to just update the three notes to include this >>> additional data *without losing all the state*. >>> >>> >>> >>> Does anybody have any suggestions for how to do this? I think part of >>> the challenge is cross-linking the "zkclose" lines in my note with some IDs >>> in Mnemosyne so that when I generate the new tab-separated file with >>> updated cards, each new card can be associated with the corresponding card >>> previously imported to Mnemosyne's db. Perhaps there's some way I can >>> generate some ~random IDs (in a very large namespace so that the >>> probabilities of collisions are negligible) and just insert the notes with >>> such IDs? Is something like this possible? Failing that, is there some way >>> to reimport notes and have Mnemosyne just update previously imported notes? >>> >>> >>> >>> Perhaps I should generate SQL sentences and import them directly into >>> Mnemosyne's sqlite database? That sounds a bit brittle, so I'm looking for >>> some alternative. :-) But, failing that, I guess I'll look more closely at >>> SQLite.py to try to make sure I understand the semantics of the fields in >>> the "insert into cards" statement in SQLite.add_card. But, yeah, I'd rather >>> use a more "supported" route. :-) Maybe there's some other format (than the >>> tab-separated text files) that supports importing cards containing some ID? >>> >>> >>> >>> Thanks in advance for all your help! And, apart from this, thanks a ton >>> for maintaining such a useful piece of software! It has had a very positive >>> impact in my life. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "mnemosyne-proj-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/mnemosyne-proj-users/CAJphAxVy%2BGn-LxTEDupMTRR0f0NSMKRFteAptku6xv4eOpe%3DUQ%40mail.gmail.com >>> <https://groups.google.com/d/msgid/mnemosyne-proj-users/CAJphAxVy%2BGn-LxTEDupMTRR0f0NSMKRFteAptku6xv4eOpe%3DUQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "mnemosyne-proj-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/mnemosyne-proj-users/004001d61a2b%24f5c829a0%24e1587ce0%24%40gmail.com >>> <https://groups.google.com/d/msgid/mnemosyne-proj-users/004001d61a2b%24f5c829a0%24e1587ce0%24%40gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > You received this message because you are subscribed to the Google Groups > "mnemosyne-proj-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/mnemosyne-proj-users/CAJphAxW--3RVOZD7%3DVhhQ1t_agVpc7gU3CZ7t_a0bt%2BpknXkHw%40mail.gmail.com > <https://groups.google.com/d/msgid/mnemosyne-proj-users/CAJphAxW--3RVOZD7%3DVhhQ1t_agVpc7gU3CZ7t_a0bt%2BpknXkHw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "mnemosyne-proj-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mnemosyne-proj-users/CAMdxoPHM62bqH%2BiHMPXfHWEfX2D7aGP0ZdtDMHQgW_e1tT0PFg%40mail.gmail.com.
