Open tvhong opened 2 years ago
Here are some useful resources related to this:
The algorithm for priority queue in SIAC addon (aka Searching, PDF Reading & Note-Taking in Add Dialog) is interesting.
It also supports a single queue for all articles. Simplistically, the algorithm for determine ranking within the queue can be defined as:
# priority between 1-100 with 100 being the highest
# higher rank means higher position in queue
rank = priority * timeSinceLastReview
This means that between topics with same "timeSinceLastReview" value, ones with higher priority will appear earlier in the queue. And between topics with same priority, ones with longer timeSinceLastReview will appear earlier.
This seems like a fairly good algorithm and clearly has served the author of SIAC very well.
However, in order to correctly compare topics with different priority and timeSinceLastReview, we'll need a bit more calibration. The author of SIAC did this by introducing PRIORITY_SCALE_FACTOR
and PRIORITY_MOD
configurations. Additionally, they needed special logic for days_delta < 0.5
.
# How many times more important is a priority 100 item than a priority 1 item?
PRIORITY_SCALE_FACTOR : int = get_config_value_or_default("notes.queue.priorityScaleFactor", 5)
# how should priority be weighted
PRIORITY_MOD : float = get_config_value_or_default("notes.queue.priorityMod", 1.0)
def _calc_score(priority: int, days_delta: float) -> float:
prio_score = 1 + ((priority - 1) / 99) * (PRIORITY_SCALE_FACTOR - 1)
if days_delta < 0.5:
return days_delta + prio_score / (PRIORITY_MOD * 10000)
else:
return PRIORITY_SCALE_FACTOR * days_delta + PRIORITY_MOD * prio_score
I spent sometime thinking about how we could simplify the algorithm but came up with the exact same 2 configuration values that SIAC introduced. However, from a normal user's point of view, the exact meaning of these 2 configurations are quite mysterious.
At this point, I think it is more difficult to understand the SIAC-like algorithm than the SuperMemo's priority queue algorithm.
So, here's how I envision how next review date in IR would look like:
Here's a rough outline of the scheduling algorithm:
# priority 1-10 with 10 being highest
newInterval = prevInterval * (1 + 1/priority)
So, for a priority 10 item with prevInterval = 5 days
, newInterval = 5 days * (1 + 1 / 10) = 5.5 days
.
And for a priority 5 item with prevInterval = 5 days
, newInterval = 5 days * (1 + 1 / 5) = 6 days
.
And to rank items in the Outstanding Queue, we'll use (priority, lastReviewTime). Items with higher priority (10) will be higher in the queue. If they have the same priority, the one with larger lastReviewTime will be higher. Using lastReviewTime this way, we get the benefits that extracts from the same article will show up in order, and before the main article.
Describing the above from a user's perspective:
(This is similar to the current experience) Import an article and specify the priority of the card. The card's next review date depends on its priority.
Open an IR deck. Read the first article or extract from the Outstanding Queue. After finish reading, press "Show Answer". In the "back" of the card, modify the priority if desired. Once done, click "Next". The reviewed card will be scheduled for a future day. Repeat until all cards in Outstanding Queue is reviewed. If there are remaining cards by the end of the day, they are auto-postponed to a future day.
Open the outstanding queue via Read > Outstanding. See a modal with articles and extracts in priority order. This modal is read-only. To edit, switch to the Organizer view.
Open Organizer view from Read > Organizer. Select some cards and click "Change next review date". Enter new value and save. If the next review date is today, the card is added to the Outstanding Queue.
Open Organizer view from Read > Organizer. Select some cards and click "Reset interval". This will reset the next review date to 1 and restart the interval calculation
We can store additional fields into cards from Anki 2.1.55. This might be useful. https://github.com/ankitects/anki/issues/2039
I'm implementing this idea in https://github.com/tvhong/incremental-reading/tree/vhong/pq2 . I can get the Outstanding queue and the scheduling working. But cannot show the cards according to the order in the Outstanding queue.
I tried overriding Reviewer._get_next_v1_v2_card
and Reviewer._get_next_v3_card
in that branch (reference), but that doesn't work because Reviewer keeps track of cards in its internal data structure.
I could probably override getCard method in the v2 scheduler. But the v3 scheduler uses get_queued_cards, which queries data directly from rust backend, is a lot harder to override.
Checking other addons that change review orders, they only support scheduler v2.
Examples:
I'm gonna put this one on hold.
Don't wanna add a new feature that does not work on the latest scheduler.
Here's a post to ask about how to override review order on Anki's forum: https://forums.ankiweb.net/t/how-to-override-review-order-in-scheduler-v3/23786
Is your feature request related to a problem? Please describe. Currently, the Priority Queue feature in IR add-on only supports a priority value for each card.
There are two main ways a user can use the priority queue:
However, both these approaches have shortcomings when a user has many cards in the queue (hundreds). Approach (1) prevents the user from ever getting down to the lower priority cards. Approach (2) means the user spends too little time on the important cards and too much time on unimportant ones.
In SuperMemo, apart from a priority, each topic (equivalent to IR card) also has a next review date. Everyday, SuperMemo creates a list of outstanding repetitions for all topics whose "next review date" is on that day. Additionally, topics within the outstanding repetitions queue are ranked based on their priority. During the learning session, the user reviews the highest priority topic first. And if the user does not finish the outstanding repetition queue for that day, subsequent topics are rescheduled for a later day.
The algorithm for rescheduling leftover topics from the outstanding repetitions queue is described below:
http://super-memory.com/help/il.htm
Describe the solution you'd like