mortii / anki-morphs

A MorphMan fork rebuilt from the ground up with a focus on simplicity, performance, and a codebase with minimal technical debt.
https://mortii.github.io/anki-morphs/
GNU Affero General Public License v3.0
61 stars 9 forks source link

fields not updating after re-calc #220

Closed syfgk closed 7 months ago

syfgk commented 7 months ago

Describe the bug

(For context, I'm using AnkiMorphs with the Chinese SpaCy models.)

Here's the bug: after running re-calc, some AnkiMorphs fields are not updating.

Below is one example. Notice that am-unknowns and am-unknowns-count are populated. However, I'd only expect this for new cards. This card, though, is one I've reviewed four times already. Because it's seen, I'd expect am-unknowns to be null and am-unknowns-count to be zero. Am I misunderstanding how re-calc works?

image


image

I should note that this is not affecting all seen cards. There are other (seen) cards that are being re-calc'd as I'd expect (i.e., am-unknowns and am-unknowns-count are empty and 0, respectively).

My setup

mortii commented 7 months ago

Here's the bug: after running re-calc, some AnkiMorphs fields are not updating.

This seems to directly contradict this:

Notice that am-unknowns and am-unknowns-count are populated. However, I'd only expect this for new cards.

I'll assume you meant that the extra fields are updating when the shouldn't.

The only extra field that should update on non-new cards is the am-highlighted field. In this context "new" means cards not in the new-queue, it might be possible to move cards to the new-queue if you reset them, and you might see the still see the review count if you don't select Reset repetition and lapse count, but I haven't checked.

You could double check if the fields are actually updating by erasing all the data in the extra fields and then running recalc again.

syfgk commented 7 months ago

Can we walk through a hypothetical example to confirm my understanding of how re-calc works?

Let's say, for instance, I have one new card which has 1 unseen morph. Since this is a card I have not reviewed yet, I would expect that running re-calc would result in the following:

Now, after I review the card, if I run re-calc again, my understanding is that I would now see the following:

Is my understanding correct?

mortii commented 7 months ago

Now, after I review the card, if I run re-calc again, my understanding is that I would now see the following:

* `am-unknowns` = blank

* `am-unknowns-count` = 0

Is my understanding correct?

No, they will keep having the same values as when the card was new, since they don't get updated, in this case:

This essentially freezes the card in the same state as when you first review it, that way you can have the am-unknowns field visible on your card and not lose it the next time you review.

So for this card: image

I would still see the word on the top, even though it's not technically "unknown" to me anymore. This makes sure that useful context is not lost on future reviews.

syfgk commented 7 months ago

Ah, ok. So, follow-up question: why do some cards have:

mortii commented 7 months ago

If you have two cards in this order:

card queue status unknown morphs unknown morphs count
Card 01 new whatever 1
Card 02 new whatever 1

and you learn the first card, then the morphs on that first card will no longer be unknown on any new cards:

card queue status unknown morphs unknown morphs count
Card 01 review whatever 1
Card 02 new 0

does that make sense?

syfgk commented 7 months ago

It's making more sense! In this case we're assuming the "unknown morphs" are the same across both cards, right?

mortii commented 7 months ago

In this case we're assuming the "unknown morphs" are the same across both cards, right?

Sorry, it wasn't a great example, but yes, both cards have the same unknown morph "whatever". Substitute it with "airplaine" or "人" or any other morph.

Btw, I'm not saying this current approach is good, in fact, the am-unknowns-count field should probably update for all cards regardless if they are new or not, that way the sorting by that field would be more useful. Do you have any suggestions/preferences for a better approach?

syfgk commented 7 months ago

Ah! I see, ok things are making sense now. So let me ask this:

Let's say I have these cards, both are new:

card queue status unknown morphs unknown morphs count
Card 1 new A, B 2
Card 2 new A 1

Now let's say I review the first card. My understanding is that this is what I'd now see:

card queue status unknown morphs unknown morphs count
Card 1 review A, B 2
Card 2 new 0

Is this correct?

Edit: Thinking about this again, I guess the wrench here is that I'd technically see Card 2 first, right? Since that's the one with the fewest morphs. So my tables should instead be something like:

Table 1 (both cards are new) card queue status unknown morphs unknown morphs count
Card 1 new A 1
Card 2 new A,B 2
Table 2 (after Card 1 has been reviewed): card queue status unknown morphs unknown morphs count
Card 1 review A 1
Card 2 new B 1
mortii commented 7 months ago

Yep, both of those scenarios are correct, although the first one should realistically only happen during some custom review circumstances or if they are in different decks.

syfgk commented 7 months ago

Nice! Here's my suggestion: have four extra fields instead of two

Here’s an example:

Table 1 (card is new)

card queue status unknown morphs unknown morphs count all morphs all morphs count
Card 1 new A,B,C,D 4 A,B,C,D 4

Table 2 (card has been reviewed)

card queue status unknown morphs unknown morphs count all morphs all morphs count
Card 1 review 0 A,B,C,D 4

What do you think?

mortii commented 7 months ago

That is very logical, and I don't mind adding new extra fields (I coincidentally reached the same conclusion about adding an "all morphs count" extra field in #195)

I don't really see how prevent the loss of the unknown morph after the first review though, like I mentioned in my previous comment https://github.com/mortii/anki-morphs/issues/220#issuecomment-2053691213, that context can be pretty important later. Any ideas?

syfgk commented 7 months ago

Is the image in that comment both sides of your card, or just one side? I want to make sure I'm oriented correctly and know what's on the front and back.

mortii commented 7 months ago

Here is another example card:

Screenshot from 2024-04-14 15-14-34 Screenshot from 2024-04-14 15-15-00

the template looks something like this (simplified): image

where the am-unknowns extra field is show on the front and back.

syfgk commented 7 months ago

Thanks for sharing! What's the value of showing am-unknowns on the front instead of just having am-highlighted?