-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloze Update: Adds Cloze hints, Anki-Like Clozes, Cloze Overlapping and Custom Cloze Patterns #943
Conversation
…) and generalized overlapped clozes
Hello @st3v3nmw and @Stefanuk12, I hope you're both doing well! First and foremost, I'd like to express my appreciation for the work you've both been doing on the project so far. It's inspiring to see your dedication to this incredible Obsidian plugin. Yesterday, I had the opportunity to open this PR addressing several issues related to the use of Clozes. Upon submitting it, I noticed that @Stefanuk12 had already opened PR #769 addressing issue #93 five months ago, which unfortunately went unnoticed. Additionally, @st3v3nmw, I noticed that you updated the status of issue #93 to "In progress," which made me wonder if you were already working on it. I'd like to sync our efforts to ensure that all contributions are considered in the best possible way. My goal is not only to offer my solution but also to recognize your previous work and ensure that the project progresses collaboratively and efficiently. Please let me know what you think about all of this, what stage you're at, your thoughts on the current PR, and if I can assist you in any way. Thank you once again for your hard work. I'm looking forward to the evolution of Clozes in the project. Best regards, Ocimar Santos (MotaOcimar) |
Lovely PR btw, a lot better and expansive than mine! I have pretty much abandoned Obsidian so I won't be much help unfortunately. Really sad how my PR was overlooked :( , but I hope yours gets reviewed since this is a KEY thing this plugin is missing. |
Hello again! Firstly, @polyipseity, my apologies for the oversight in my previous message. I realized after sending it that I forgot to include you, who opened PR #607 addressing issues #556 and #387. I appreciate your work and would like to hear your thoughts on this PR too. @Stefanuk12, thank you for your kind words regarding the PR. I'm sorry to hear that you've pretty much abandoned Obsidian; your opinion remains valuable to me, though. If any insights or suggestions arise, I'd be grateful to hear them. |
Hi @MotaOcimar I've only had a chance for a brief look, but looks great! I'm working on [FEAT] Refactor code to support diff methods of storing the scheduling info, and diff SR algorithms #878 , so after that I should have time to review in detail. Great work! Cheers |
Hey @ronzulu! It's awesome to have you here! I just wanted to take a moment to express my gratitude not only for your willingness to review this PR but also for all the hard work you've been putting into the project. Your immense participation, both in code and in discussions, hasn't gone unnoticed. Rest assured that the time and effort you've invested here have made a significant impact. I'm particularly excited about feature #878 too. Keep up the fantastic work! Best, |
Hi, I am very interested in using spaced repetition in combination with clozes for language and especially vocabulary training.
Would it be possible to integrate that feature? Thank you very much in advance, Silias |
Hi Silias (@SeLiEnisyst)! Let me see if I understood well. You want to write something like this on the note:
Have this as card front/question:
And this as card back/answer:
If that's correct, although I don't think it's possible to create cards exactly like this yet, I think it will be possible to do something very similar after this PR is completed: Assuming we are using the Anki-like pattern for Simplified Clozes (e.g.,
This will display the front of the card as:
And the back of the card as:
I understand that the front and back formatting may not be exactly as desired. But I hope that it will still allow you to review and practice your vocabulary. Additionally, I saw you expressed interest in having a delimiter for the beginning and end of the note (the Silias, let me know if I understood everything correctly and if, despite the limitations, this way can meet your request. Best, |
Hi @MotaOcimar sorry I haven't managed to look at your PR yet. I'm still working on #878. I'm hoping to put in my PR for it hopefully this week, then will have a chance. Would also be great if @st3v3nmw would look at this PR as well :-) |
I found! It's issue #450 [BUG] Cloze Cards require blank lines before and after to create atomic card |
Hi @MotaOcimar, Thank you very much for your detailed answer!!! :)
Additionally to the original sentence, there should be some kind of hint for which part of that sentence a translation is asked for. Therefore, I suggested indicating that part with the ==bold syntax==. My suggestion for the front card would be: picking a new painting, would be ==to succumb== to the very impatience. The back of the card would just have the translation, in my case: "unterliegen". ... |
MotaOcimar commented on Apr 26
Nice. It is definitely better than hardcoding the cloze token delimiters. This would supersede my PR. |
Hi @SeLiEnisyst! I wonder if using a basic card would achieve what you want. Example: Raw note:
Sorry for the delay in responding. |
Hi @MotaOcimar I've finally completed #878 and so should be able to look at your great PR over the next week or 2. |
Hi @MotaOcimar thanks for your answers to #426 (comment) I thought it might be best if we actually first work on the user documentation. This way we can agree on terminology et cetera, and it does need to be done in any case. I've made a start on this, and was wondering if it's okay to push what I have done to your branch. I haven't done this before, but if permissions permit this, then I assume this should be possible. I notice that "Maintainers are allowed to edit this pull request." is enabled. I am categorised as a "collaborator" rather than "maintainer", so I'm not sure. |
Hi @ronzulu! Thanks for your suggestion and sorry for the delayed response. I agree that starting with user documentation is a good idea to establish consistent terminology. However, I believe it would be better handled in a separate PR, as they address different demands. New terms introduced by this Clozes PR can still be included here. What do you think? |
Sounds good to me. I've been working on #1029 to improve the documentation and give it some structure. After that I'm happy to separately work on the documentation for your work (unless of course you prefer doing it yourself) |
Oh, great! Let me know if there's anything I can do to help. I don't know if it will work either, but feel free to try adding here commits related to Cloze documentation. Thanks for the support, Ronny! |
Hi @MotaOcimar I've made a start on the documentation, and decided to put it in its own branch for now. I've added in some notes and thoughts about terminology, so would be great if you can review. Have you needed to build the documentation before? If you want to see how it all looks like rather than just reading the markdown files, see https://www.stephenmwangi.com/obsidian-spaced-repetition/contributing/#viewing-docs-locally Cheers |
Hi @MotaOcimar. I'm considering a switch from Anki to Obsidian. In Anki, I'm using https://github.com/nihil-admirari/modern-cloze-overlapper (a rewrite of https://github.com/michalrus/anki-simple-cloze-overlapper; original repo has a nice GIF with a demonstration of features). Is it possible to port the following features from Anki?
|
Hi @nihil-admirari , thanks for the ideas. I would suggest creating a new issue with them, and deleting the comment here. @MotaOcimar has put in so much effort on this feature already, personally I think it's better if we get all the work done to date in a mainstream release before expanding the capabilities further. Regards |
Thank you @nihil-admirari for the ideas! I have to agree with Ronny, it will be easier to focus on one thing at a time. Create the issue and we can better understand your suggestion there |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @MotaOcimar.. First of all, apologies for taking forever to get to this pull request..
I've left two comments, mostly that the parser has evolved since this PR was made. I'm not sure how much effort it'll take to port those changes over.
Thanks for the effort you've put into this. Once we have this merged I'll update the documentation to reflect.
(convertBoldTextToClozes && /\*\*.*?\*\*/gm.test(currentLine)) || | ||
(convertCurlyBracketsToClozes && /{{.*?}}/gm.test(currentLine))) | ||
) { | ||
} else if (cardType === null && clozecrafter.isClozeNote(currentLine)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi all, I had to rework the parser once again (* sigh *) because of recent performance issues. As part of that rework, I rebased & included changes in this PR in #1118 & #1117. I've just made a release v1.13.0 that ships with custom cloze patterns 🥳 all thanks to @MotaOcimar's work. The updated documentation is live here. I've tested the release but not as extensively as I normally would. Perhaps we need a beta version of the plugin? That being said, I'm on standby to fix bugs ASAP. Just give me a shout. I'll go ahead and close this PR now. Cheers. |
Hey @st3v3nmw, how's it going? First of all, I'd like to thank you for adding those features in the rebase and for already making the release. I'm really happy to be able to contribute to the project. I have a great appreciation for the plugin and the positive impact it has on the learning community. Regarding the bugs, I’ve come across a few. I have them noted down, but I don’t have access to them right now. It’s likely that the issues and fixes will involve the package I created, Clozecraft. I’ll be on vacation in 2 days, and as soon as I get some time and my head is a bit clearer, I plan to post the bugs I found here and start working on solutions for them. Once again, thank you for accepting my contributions and for all the support. I’ve really enjoyed being a part of this project and hope to continue contributing. Best, |
Hi @st3v3nmw! Here are the issues I found with this Cloze update:
For three of them the solution is in the Clozecraft package and one of them is here in the plugin. So, for now I created the issues in their respective projects. I intend to work on each of them, starting with #1155. Best |
Hello! This PR addresses the following issues: #581, #556, #451, #426, #387, #284, #93, introducing several new features:
The implementation leverages the Clozecraft package, a Cloze parser and Card formatter developed by me specifically for this purpose. Feel free to explore, ask questions, and contribute. Your feedback is highly appreciated.
I've opened this PR as a draft because there are still a few tasks pending:
Features
Cloze Types
Simplified Clozes
Simplified Clozes are the Cloze Type we have been using so far. They keep working as before, but now you can add hints to them. That means each card will occlude one deletion, showing its hint if available, while leaving the other deletions visible.
For instance, the following note:
Will generate two cards, with the following fronts:
This [...] doesn't need to have number on clozes
This note doesn't need to have [hint] on clozes
And both will have the same back:
Classic Clozes
Classic Clozes are the same as Simplified Clozes, but they also have a sequence number used to sort and group deletions.
For instance, the following note:
Will generate two cards, with the following fronts:
This is a [a hint]. This is too, but without hint. And this one is asked [...].
This is a cloze. This [...]. And this one is asked together with the first cloze.
And both will have the same back:
Generalized Cloze Overlapping
The Cloze Overlapping Generalization allows you to dictate the behavior of each deletion individually. Each deletion has its own set of actions that indicate how it will behave on each card:
a
for ask (hide the deletion answer in the front of the card while showing it in the back).h
for hide (hide the deletion answer both in the front and back of the card).s
for show (show the deletion answer both in the front and back of the card).For instance, the following note:
In this example, 4 cards will be generated, where items 1 to 4 will be asked sequentially. When asking Item 1, all other text will be hidden. When asking Item 2, just the Item 1 and the context will be displayed. When asking Item 3, only the Item 2 will be displayed. Finally, when asking Item 4, both the Item 3 and the context text will be displayed.
Custom Cloze Patterns
You can now create your own Cloze Patterns. For instance, to emulate Anki-like clozes (e.g.,
{{1::text::hint}}
), simply add the following pattern to your settings:Brackets
[]
delineate where the sequence number and hint will be placed, along with any additional characters of your choice (e.g., the::
in the example above). Clozecraft automatically generates a regex pattern based on your custom pattern. Sequence numbers are identified by finding numbers between brackets, hints by finding the wordhint
in brackets, and the deleted text by finding the wordanswer
.Here are some examples of custom patterns:
{{[123::]answer[::hint]}}
Brazilians speak {{Portuguese}}
Or, with hint:
Brazilians speak {{Portuguese::language}}
Brazilians speak {{1::Portuguese}}
Or, with hint:
Brazilians speak {{1::Portuguese::language}}
Brazilians speak {{a::Portuguese}}
Or, with hint:
Brazilians speak {{a::Portuguese::language}}
==answer==[^\[hint\]][\[^123\]]
Brazilians speak ==Portuguese==
Or, with hint:
Brazilians speak ==Portuguese==^[language]
Brazilians speak ==Portuguese==[^1]
Or, with hint:
Brazilians speak ==Portuguese==^[language][^1]
Brazilians speak ==Portuguese==[^a]
Or, with hint:
Brazilians speak ==Portuguese==^[language][^a]
In your settings, you can add multiple patterns at once, separating them with a new line:
Then, you can use them in your notes:
Remember, deletions must be of the same Cloze Type. You can't mix, for instance, a Classic Cloze with a Simplified Cloze in the same note, as they employ different ways to sort and identify the cards.