mortii/anki-morphs

fields not updating after re-calc

Closed this issue · 14 comments

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

  • Operating System: MacOS
  • Anki Version: Version ⁨23.12.1 (1a1d4d54)⁩; Python 3.9.15 Qt 6.5.3 PyQt 6.5.3
  • AnkiMorphs Version: v2.2.2

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.

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:

  • am-unknowns = whatever the 1 unseen morph is
  • am-unknowns-count = 1

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?

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:

  • am-unknowns = whatever
  • am-unknowns-count = 1

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.

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

  • am-unknowns = blank
  • am-unknowns-count = 0

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?

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

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?

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

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.

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

  • unknown-morphs: shows all the unknown/unseen morphs on a new card. Once a card has been reviewed/seen and re-calc is run, this field goes blank

  • unknown-morphs-count: displays the count of unknown-morphs. Once a card has been reviewed/seen and re-calc is run, this field shows 0

  • (new) all-morphs: this shows all morphs on a card, regardless of (a) known/unknown, or (b) card state. So even after the user has reviewed/seen the card, this field stays the same

  • (new) all-morphs-count: this is a count of all-morphs; same logic applies. After the user has reviewed/seen the card, this field also stays the same

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?

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 #220 (comment), that context can be pretty important later. Any ideas?

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.

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.

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