AnKing-VIP / AnKing-Note-Types

https://www.ankingmed.com
GNU Affero General Public License v3.0
41 stars 20 forks source link

Add Modern Cloze Overlapper to ANKING note type #188

Open amatsune opened 1 month ago

amatsune commented 1 month ago

Which Note Type (and version) is this about?

All notes that use Cloze deletions

Checklist

What Anki version are you using?

24.04.1 Qt6

What Operating system are you using? (i.e. MacOS, Windows, Linux)

Windows 11

Problem case

Currently it's not possible to create real "overlapping clozes" in the Anking card format. I'm aware of the One-by-One cloze feature, but it lacks the option to hide the remaining cloze field (similar to the Image Occlusion hide one-guess one/hide all-guess one.

I often have a need for cards that share overlapping cloze contents but that only reveal one field in the front like this:

image

I achieved this result using the Modern Cloze Overlapper (MCO).

I tried to make a copy of the Anking card type and edit the script into the card format, but didn't manage to get it to work. I had a card with duplicated text:

Front: image

Back: image

I tried removing the part of the code that output the front/back text, and managed to remove the duplication issue, but that gave me another set of problems: I either got rid of the anking one-by-one function and formatting/styling (notice the difference in the shade of pink of the cloze field) or the MCO didn't do anything.

Front:

image MCO single cloze (Card 6) - lost Anking formatting

image Anking O-b-O (card 6), all other clozes revealed

image MCO (Card 7) - lost Anking formatting, otherwise working as expected

image Anking O-b-O (Card 7) working as expected

Back:

image MCO (card 6) lost Anking formatting

image Anking (Card 6) all revealed by default

image MCO (Card 7) no O-b-O - lost Anking formatting

image If I do click the toggle button, however, it re-establishes the one-by-one feature, though it defeats the purpose if it's revealed before I try to answer the card. The click to reveal function doesn't work, only the reveal next button.

image Anking O-b-O (Card 7), two answers clicked on to reveal out of order - works as intended

I can't seem to find a way to reconcile the two features and get them to work together.

Solution

Integrate the function of the MCO card to the Anking note types (including the Before|After|OnlyContext|RevealAll|InactiveHints customization field).

Else, make the Anking note type at least compatible, for those who decide to manually add the required card formatting script.

Else, if possible, I'd settle for some guidance on how to create a custom workaround for me and others who might have an interest.

More information

I know I'm overreaching at this point but... since this issue is regarding overlapping clozes, if there was a way to create clozes that only partially overlap such as:

{{c1::((c3::This [[c2::is)) a ((c3::cloze}} deletion))]]

Card 1 […] deletion

Card 2 This […]

Card 3 […] a […]

Not sure how the syntax for that would have to work, so I used multiple punctuation marks to make them clear, though something like this would likely be optimal:

{{c1::{{c3::This {{c2::is::c3}} a {{c3::cloze::c1::hint}} deletion::c3::multi word hint}}::c2}}

Card 1 [hint] deletion

Card 2 This […]

Card 3 […] a [multi word hint]

If keeping the MCO Before|After|OnlyContext|RevealAll|InactiveHints field, a possible result would be something like:

{{c4::This {{c1::is a much {{c2::longer::c1::hint 1}} cloze::c2::hint 2}}::c4::hint 4}} deletion for {{c3::exemple::c3:: hint 3}}

Card 1 This [hint 1] cloze deletion for exemple

Card 2 This is a much [hint 2] deletion for exemple

Card 3 This is a much longer cloze deletion for [hint 3]

Card 4 [hint 4] deletion for exemple

Some different settings would result in:

Card 1 (1,1,false,true,false) This [hint 1] cloze deletion for exemple

Card 1 (0,2,false,true,true) This [hint 1] cloze deletion for exemple

Card 2 (1,0,true,true,false) This is a much [hint 2] deletion for

Card 3 (1,1,false,true,false) This [...] cloze deletion for [hint 3]

Card 4 (0,0,false,true,true) [hint 4] deletion for [hint 3]

Card 4 (1,1,false,true,true) [hint 4] deletion for exemple

EDIT: Finished the suggestion and some formatting.

AnKingMed commented 1 month ago

@abdnh or @RisingOrange I think I discussed this idea with you in the past to make it possible to do a cloze overlapper via the note styling without needing the addon. Might be worth looking into this here?

abdnh commented 1 month ago

@AnKingMed I think you mentioned implementing something like this https://github.com/michalrus/anki-simple-cloze-overlapper?

AnKingMed commented 1 month ago

Yeah whatever you think is simplest and best

abdnh commented 1 week ago

The trickiest part is probably that we need to add a new field to the note type and make sure it's working properly with AnkiHub.

AnKingMed commented 1 week ago

Could we use one by one field?

abdnh commented 1 week ago

We can but that's unintuitive, since it's not tied to the one by one feature.

abdnh commented 2 days ago

@amatsune Does this sample deck work as expected for you? (Try it in a new profile) cloze overlapper.zip

It's a basic implementation of cloze overlapper that works with the one-by-one feature.

amatsune commented 2 days ago

I'll have to do some testing. Can't do it today though