Giter Site home page Giter Site logo

anki_cousins's Introduction

Anki plugin to bury related cards even if they're not siblings. Configure rules so you can suppress similar cards from different notes. These rules can are also used in identifying duplicate cards in the card browser.

NOTE: this plugin will no longer work with the Anki V3 scheduler which is currently in Beta.

Configuring Rules

To configure, go to "Tools" > "Add-Ons" and select the "Bury Cousins" plugin and click "Config". In that menu you can rules for burying cards like "When reviewing a cloze deletion, bury any cloze cards whose text field is very similar to the reviewed card's text field" or "when reviewing a basic card, bury any basic cards whose Front field starts with the same characters as the reviewed cards Front field"

File or fix bugs here: https://github.com/AlexRiina/anki_cousins

Available Rules

Similarity scores fields on fuzzy similarity so "xxxyyy" and "xxyxyy" have a high match score similar but not super high.

This test requires that the shorter field is at least 4 characters.

Prefix looks at the percentage of the longer field that matches the shorter field so "1234567" and "123" match on the first 3 characters so their match score is 3/7.

This test requires that the shorter card has at least 4 characters.

Contains looks at whether the base field contains the second field exactly, regardless of the threshold you set.

This test requires that the shorter field is at least 4 characters.

Contained by looks at whether the exact base field is contained by the second field, regardless of threshold set. This is the reverse of contains.

This test requires that the shorter field is at least 4 characters.

Cloze contained by looks at whether cloze answers in the base field are in the second field. So if you have a cloze deletion like Rabbit babies are {{c1::altrical::precocial / altricial}} but don't want to see the definition of that word in the same session, you can suppress the definition card using "cloze contained by."

This test is limited to answers with at least 4 characters and requires a word break surrounding the answer to protect against some common cases like testing the spanish article for water with {{c1::el::el / la}} agua from suppressing all cards containing el.

Development

The easiest way to work on this locally is to clone this repo and symlink the src folder into your anki plugins. This will register a plugin which will share settings with any other copy of this plugin that you have installed.

On linux, with my Anki installation, this can be done by

git clone [email protected]:AlexRiina/anki_cousins.git
cd anki_cousins
make develop

To avoid overwriting your main settings while working on this plugin, you can either modify the SettingsManager.key or create a test profile in Anki (File -> Switch Profiles) and develop against that collection.

Testing

Anki's a bit tough to test around. Instead of trying to hack an Anki testing environment, this plugin relies heavily on type statements and manual testing.

To run the small automated linters and tests, run make test.

The manual testing checklist is:

  1. read current settings
  2. add a new rule
  3. delete a rule
  4. close Anki to make sure rules persist
  5. open Anki and make sure rules load
  6. confirm cousins are suppressed
    1. create a new deck
    2. add Basic cards like
      • ("Basic front 1", "1")
      • ("Basic front 2", "2")
      • ("3", "3")
    3. add a rule to suppress Basic cards when rehearsing a Basic card when the Front side is the similar (threshold 0.80)
    4. review deck and confirm that the rehearsing suppresses card

anki_cousins's People

Contributors

alexriina avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

noobj2

anki_cousins's Issues

a failsafe is needed

Hi,

I think that a useful feature would be that rule that bury more than X number of cards in one review should be ignored.

Sometimes some of my rules will just bury 150 cards in one take and that's not something I want. But these rules are very useful the rest of the time.

name of media should be kept

Hi,

I noticed that there is a method called that remove all the html of the card, leaving only actual text.

I don't think it's a good idea to remove completely the media. Personnaly, I sometimes use a screenshot as a source in a "source" field in my cloze. I think that the parsing should keep the name of the picture or sound media etc as a word in the card. As I think it is relevant to decide to bury the cards or not.

What do you think?

suggestion : enable hiding reviews but not new cards

Otherwise I miss the big picture by doing the new cards in the order I created them.

edit : same with learning cards. I graduate my cards over a long time so it's not good for me to bury them while they are new or in learning.

New feature

I love your add-on but have a request if you have the time!!

I'm in medical school and use a lot of premade decks that have overlapping concepts or straight up the same concepts re-worded differently or in a different card format. This especially happens when using multiple decks from different people. For example:

1."Cloze vs basic card types"

Cloze:

{{c1:Kallmann syndrome}} is a cause of delayed puberty that also causes anosmia.

Basic:

Front: What cause of delayed puberty also causes anosmia?

Back: Kallmann syndrome

2."Cloze vs Cloze"

{{c1:Kallmann syndrome}} is a cause of delayed puberty that also causes anosmia.

{{c1:Kallmann syndrome}} causes delayed puberty and anosmia.

Now imagine this but a lot lot more of it. The repetitions add up and take up a lot of time. Could we have a feature that has the same functionality as your current one in finding similar cards, but instead of burying them, tag them or allow a browser view of all similar cards sorted based on (%) similarity.

End goal: Do less of the same card lol. It would be nice if the add-on confirmed deletions and what-not. I know there is a lot of people on r/medschoolanki that would love this ability.

Unable to set a config

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.35 (84dcaa86) Python 3.8.0 Qt 5.14.2 PyQt 5.14.2
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2021-01-01 20:46:28

Caught exception:
Traceback (most recent call last):
File "aqt\addons.py", line 896, in onConfig
File "C:\Users\micha\AppData\Roaming\Anki2\addons21\1072815885\interface.py", line 81, in show_settings_dialog
SettingsManager(col).save(
File "C:\Users\micha\AppData\Roaming\Anki2\addons21\1072815885\settings.py", line 80, in save
set_config = self.col.set_config()
TypeError: set_config() missing 2 required positional arguments: 'key' and 'val'

These are the extensions I have right now.
image

Add-on has no configuration !?

Version ⁨2.1.43 (0fbae6bc)⁩
Python 3.8.6 Qt 5.14.2 PyQt 5.14.2

at first the add on didn't work for some cards(imageOcclusioncard Specifically i use it for )
i went into setting and i can see the config and i can click it this time ,so i click it to see any problem in there but everything was fine,so i was confused!
and then disabled the addon [Bury Cousins (related cards that aren't siblings)]
and i tried this add on : [Bury related notes]
i couldn't make this new add on work neither, or i didn't know exactly how it work! so i decided to disable it and back to (Bury Cousins) addon,
hereafter i toggle enable it, I couldn't press the config button, and even if i double click on it show this message saying [Add-on has no configuration]:
image

tried to delete and reinstall the addon from start but nothing works, still no config button !!?

rule "cloze answers contained in" should not work for few words

Hi,

I don't think it's a good idea for this rule to be working for less than 3 words. For example I sometimes have a cloze that is a yes no question, so having {{c1::3}} causes like 130 cards to be buried just because they contain the number 3.

I think it would be more sensible to ignore this rule if there is less than 3 words in the cloze OR if it contains something else than words (numbers typically)

rule window is too wide

Hi,

currently the window has button that are as wide as the longest name in your notetypes. This make my window larger than my vertical screen even though I rarely use this notetype anyway.

See the picture :
image

all the space in the rectangle is waster IMO

burying cousins only works when "bury until next day" options are checked

If the bury until next day options are not checked in the deck options, the cards will be reported as buried but not actually buried.

The root cause of this appears to be that anki's counters are based on the number of notes to remaining but the queues are based on the cards themselves. When you rehearse a card, it decrements the associated counter and then removes any sibling cards, but shared that same slot in the count.

Because I'm removing cards from other notes, the list of cards to rehearse runs out before the note count gets to 0, so anki rebuilds the list of cards to rehearse in _fillNew which uses the database queues. These are only updated anki_cousins when the "bury until next day" options are checked.

suggestion : bury cards that have been added in close proximity

Hi, great addon btw,

I can sometimes have to enter 5 different cards on the same disease but with the phrasing so different that your plugin cannot pick them up as cousins.

So I thought about it and thought it would be a nice feature to enable to automatically bury the cards that have been added just before and just after some card.

Say I add five cards in a row : 1 2 3 4 5

If in my review queue I see card #3 then your addon would automatically consider as cousin the cards 2 and 4, or 1 2 4 and 5 depending on user settings.

This would be an interesting way to reduce a daily workload in a smart manner.

What do you think?

edit : related post on the anki forum : https://forums.ankiweb.net/t/bury-review-cards-created-next-to-each-other/8930

better verbose mode

Hi,

I think it would be valuable to tell the user which rule lead to how many burial. I have several rules in place and it can be hard to finetune them if I don't know which rule is burying 50 cards in one take for example.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.