Coder Social home page Coder Social logo

daedsidog / anki-autolapsenewinterval Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 1.0 690 KB

An Anki 2.1 addon which automatically adjusts the new lapse interval.

License: GNU General Public License v3.0

Python 100.00%
anki21 anki-addon python sqlite anki2-addon addon

anki-autolapsenewinterval's Introduction

Anki-autoLapseNewInterval

An Anki2 addon by eshapard which I made to work with Anki21. The addon automatically adjusts the new interval to target an 85% review success rate. A more in-depth description can be found on eshapard's code blog.

Changes

While eshapard's code blog mentions that the addon might work with Anki21 if you comment out a particular line, I discovered that lapses are rarely registered as such, and so the addon only adjusted the new interval on the first time you run it, and never again, because even if I lapsed 50 cards, they would not be detected on Anki21.

I don't know if this is due to the Anki21 migration, an original bug in the Anki2 addon, or the author's intention. From reading his post about how he intended it to work, it is very likely it is one of the first two. What I did was modify the SQLite queries to correctly detect lapsed cards and correctly calculate the success rate. I also added the option to allow the addon to work in the background without informing the user of the changes it made.

Installation

Create a folder called autoLapseNewInterval inside Anki2/addons21 (usually located in C:\Users\Username\AppData\Roaming on Windows) and place __init__.py inside that folder. If you're using older version of Anki, make sure to use one of the legacy releases appropriate for your version instead.

Usage

For more in-depth information on what the addon does, you should read eshapard's original post (backup). You can adjust the change_silently variable in the code settings to allow the addon to make changes silently without prompting you.

anki-autolapsenewinterval's People

Contributors

daedsidog avatar duncrob99 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

duncrob99

anki-autolapsenewinterval's Issues

low new interval %

hello, the addon keeps lowering the new interval % lower and lower, from 50 to 40 and sometimes lower. I am suspicious the addon is including the "relearn" phase. ie when i lapse a card i repeat the card once 45 minutes later and again 1 day later as part of my lapse settings. after i get the card correct those two times,, the new interval % takes effect..

can you confirm if it is ignoring the relearn phase? i am suspicious that my lowering new interval % is because i often get the card wrong twice in a row..

the idea of the addon is to tweak ur new interval to get 85% success on post lapse reviews, so this should not include relearning, only the success rate of the cards scheduled to a new interval.

Configuration doesn't work

Hey,
"change_silently": false,
"ignore_silently": true,
both don't work at my end.
When I start up Anki I always have to go through numerous pop-up windows
where I just get notified about no changes.
Kind of anoying ๐Ÿ˜„

regards :)

Anki 2.1.35 (84dcaa86) Error When Loading Anki

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: 2020-10-23 12:59:09

Caught exception:
Traceback (most recent call last):
File "aqt\progress.py", line 53, in handler
File "aqt\main.py", line 142, in on_window_init
File "aqt\main.py", line 190, in setupProfileAfterWebviewsLoaded
File "aqt\main.py", line 231, in setupProfile
File "<C:\Program Files\Anki\decorator.pyc:decorator-gen-212>", line 2, in loadProfile
File "anki\hooks.py", line 638, in decorator_wrapper
File "anki\hooks.py", line 633, in repl
File "aqt\main.py", line 427, in loadProfile
File "aqt\gui_hooks.py", line 2033, in call
File "anki\hooks.py", line 583, in runHook
File "C:\Users\ykama\AppData\Roaming\Anki2\addons21\372281481_init_.py", line 78, in adjLapse_startup
adjLapse_all(True) # Includes functions below
File "C:\Users\ykama\AppData\Roaming\Anki2\addons21\372281481_init_.py", line 69, in adjLapse_all
eval_lapsed_newIvl(silent)
File "C:\Users\ykama\AppData\Roaming\Anki2\addons21\372281481_init_.py", line 205, in eval_lapsed_newIvl
adj_lapsed_newIvl(dconf['id'], silent)
File "C:\Users\ykama\AppData\Roaming\Anki2\addons21\372281481_init_.py", line 175, in adj_lapsed_newIvl
lapsed_success_rate, lapsed_rev_records = og_lapsed_success_rate(name, card_sample_size)
File "C:\Users\ykama\AppData\Roaming\Anki2\addons21\372281481_init_.py", line 148, in og_lapsed_success_rate
decks = find_decks_in_settings_group(group_id)
File "C:\Users\ykama\AppData\Roaming\Anki2\addons21\372281481_init_.py", line 55, in find_decks_in_settings_group
if 'conf' in decks[d] and int(decks[d]['conf']) == int(group_id):
File "anki\decks.py", line 47, in getitem
TypeError: int() argument must be a string, a bytes-like object or a number, not 'dict'

ankiweb

Thank you so, so very much for this!!! I too noticed that the add-on stopped working properly with more recent Anki versions. I ddin't know enough to fix it. IIRC, it did work with the first versions of 2.1.

Would you consider uploading it to ankiweb so that more people can profit from it? Perhaps you need consent from eshapard.

Only adjust based on mature cards?

Hi there,

Thanks for developing this. It's awesome. I'm wondering if there is a tweak I can make in the code that would only adjust the lapse interval based on lapses for mature cards (>21 days). TLDR this means you can use higher graduating / minimum intervals to make Anki much less effort, without skewing the stats.

Cheers,

Too long file name

When I try to extract the zip file to put the files into the newly created addon folder Windows tells me that recommendations.somenumbers.css has a filename that is too long. Therefore I cannot extract it.

Anki error 84dcaa86 (Couldn't fix with_init_.py)

This happened early today, I already restarted my windows a couple of times, I was at Anki 2.1.29 when it first happened, and updated it to 2.1.40 and 2.1.44 but both of them did not even open due to https://forums.ankiweb.net/t/windows-update-broke-anki/1822.

So I downloaded the 32 bit version of 2.1.35 and the (84dcaa86) of Anki 2.1.29 was still there. I tried this fix: #4
But it did not help (I created a folder in addons with the_init_.py file inside it)

My main concern is for the Reschedule addon, it is fundamental in my workflow, although I liked pomodoro timer too. Without the reschedule I'll certainly get into an ease hell. Some other addons like killstreaks seems to be working fine, although I disabled all of them and left only Customize keyboards, pomo (which isn't working), and Reschedule (which isn't working)

Please help me out! I have 700+ reviews to take care of today and my studies are heavily dependent on Anki and this add-on.

Sorry for the inconvenience.

Debug info:
Anki 2.1.35 (84dcaa86) Python 3.8.1 Qt 5.12.6 PyQt 5.12.3
Platform: Windows 10
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2021-07-25 07:24:03

Caught exception:
Traceback (most recent call last):
File "aqt\main.py", line 286, in onOpenProfile
File "aqt\main.py", line 427, in loadProfile
File "aqt\gui_hooks.py", line 2033, in call
File "lib\site-packages\anki\hooks.py", line 583, in runHook
File "C:\Users\Andre\AppData\Roaming\Anki2\addons21\2018952444_init_.py", line 27, in start
rr = TomatoClock.OneClockAddon()
File "C:\Users\Andre\AppData\Roaming\Anki2\addons21\2018952444\TomatoClock\TomatoClock.py", line 35, in init
self.dlg = OneClock(mw)
File "C:\Users\Andre\AppData\Roaming\Anki2\addons21\2018952444\TomatoClock\ui\OneClock.py", line 28, in init
self._adjust_ui()
File "C:\Users\Andre\AppData\Roaming\Anki2\addons21\2018952444\TomatoClock\ui\OneClock.py", line 74, in _adjust_ui
self._adjust_min_list()
File "C:\Users\Andre\AppData\Roaming\Anki2\addons21\2018952444\TomatoClock\ui\OneClock.py", line 102, in _adjust_min_list
break_min_dicts = UserConfig.BREAK_MINUTES
File "C:\Users\Andre\AppData\Roaming\Anki2\addons21\2018952444\TomatoClock\lib\kkLib.py", line 116, in getattr
config_obj = load_config()
File "C:\Users\Andre\AppData\Roaming\Anki2\addons21\2018952444\TomatoClock\lib\kkLib.py", line 115, in
load_config = lambda: cls.get_config(cls.metas[cls.name].store_location)
File "C:\Users\Andre\AppData\Roaming\Anki2\addons21\2018952444\TomatoClock\lib\kkLib.py", line 171, in get_config
disk_config_obj = get_json_dict(cls.media_json_file)
File "C:\Users\Andre\AppData\Roaming\Anki2\addons21\2018952444\TomatoClock\lib\kkLib.py", line 156, in get_json_dict
return json.load(ff)
File "json_init
.py", line 293, in load
File "json_init
.py", line 357, in loads
File "json\decoder.py", line 337, in decode
File "json\decoder.py", line 355, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Doesn't make any changes to the new interval anymore

Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 5.15.2 PyQt 5.15.5
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-09-27 20:58:33
Active add-ons

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
'' ['autoLearningSteps', 0, 'None', '']
3ft Under Bury Newly Added Cards ['32017685', 2019-08-19T21:16, 'None', mod]
AJT Mortician ['1255924302', 2021-09-17T07:52, 'None', mod]
Add Table ['1237621971', 2022-04-12T17:21, 'None', mod]
Add-on folder with readable names ['519936472', 2020-03-07T04:36, 'None', '']
Adjust Sound Volume ['2123044452', 2021-05-05T13:24, 'None', mod]
Advanced Answer Sounds ['1167194350', 2022-05-29T09:30, 'None', mod]
Agent Orange Pseudo-Fuzz Defoliator ['175851166', 2020-11-20T06:21, 'None', '']
Anki Time anti-distraction helper ['998250600', 2020-09-12T23:27, '20.9.12i228', mod]
Anki Zoom ['538879081', 2020-04-04T02:20, 'v1.1.3', mod]
Anki-redesign ['308574457', 2022-08-22T20:25, 'None', mod]
AnkiConnect ['2055492159', 2022-09-19T02:11, 'None', '']
Asset Manager ['656021484', 2021-08-29T23:07, 'None', '']
Auto Ease Factor ['1672712021', 2021-03-21T19:11, 'None', mod]
Batch Editing ['291119185', 2019-08-08T19:56, 'None', '']
BetterSearch ['1052724801', 2022-01-25T23:25, 'None', '']
Browser Search Highlights ['browser_search_highlight_results', 0, 'None', '']
Browser TableEditor side-by-side horizontal split ['831846358', 2022-01-25T23:11, 'None', mod]
Bury Cousins related cards that arent siblings ['1072815885', 2021-07-20T03:23, 'None', '']
Bury related notes ['413416269', 2020-04-03T09:55, 'None', mod]
CSS Injector (2.1.41-2.1.49) ['css_injector', 2021-10-05T00:29, 'None', '']
Cardistry 2 Dynamically Adjust New Cards ['1535078906', 2020-09-03T22:52, 'None', mod]
Cloze Overlapper for Anki 21 ['109531687', 2021-01-12T04:12, 'None', '']
Colorful Tags Hierarchical Tags ['594329229', 2022-09-15T17:06, 'None', '']
Correct Answers Graph ['993120073', 2022-03-14T21:52, 'None', '']
Custom Background Image and Gear Icon ['1210908941', 2022-07-28T15:54, 'None', mod]
Customize Keyboard Shortcuts ['24411424', 2022-09-14T11:12, 'None', mod]
Dark title bars for windows ['1718996340', 2022-01-31T14:46, 'None', '']
Deck name in title 21 ['699175524', 2019-08-23T23:06, 'None', '']
Delay siblings ['1369579727', 2022-06-04T01:05, 'None', mod]
Dont remove mark on export ['909480379', 2020-02-16T10:53, 'None', '']
Enhance main window ['877182321', 2022-06-29T04:44, 'None', mod]
Extended Schema Hash ['1187737890', 2020-01-06T18:25, 'None', '']
External Note Editor vim vscode atom ['704320065', 2022-05-17T14:42, 'None', mod]
Fastbar- with nightmode support ['46611790', 2022-04-15T05:04, 'None', '']
Field AutoComplete ['511710206', 2022-04-15T13:02, 'None', mod]
Find and Replace in Card templatesNotetypesHTML ['992153575', 2021-09-17T08:34, 'None', '']
Fix Invalid Field HTML ['714624709', 2019-02-21T07:54, 'None', '']
HUMBLE PIE distinct cards studied today statistic ['2133933791', 2020-03-24T19:05, 'None', '']
Hapax Predator - find and correct misspelings ['1495282885', 2022-01-20T01:07, 'None', '']
Highlight Search Results in the Browser ['225180905', 2021-03-10T18:06, 'None', '']
Holdem Cardfield Preserves add card history ['363320830', 2019-08-13T10:23, 'None', '']
Image Occlusion Enhanced ['1374772155', 2022-04-09T09:15, 'None', '']
Learning Step and Review Interval Retention ['1949865265', 2022-08-28T22:21, 'None', mod]
Load Balanced Scheduler ['208879074', 2019-08-08T20:32, 'None', '']
Mini Format Pack (bis 2.1.44) ['295889520_bis_2-1-44', 2018-11-17T10:06, 'None', '']
Mini Format Pack ['295889520', 2019-08-07T21:49, 'None', mod]
More Decks Stats and Time Left ['1556734708', 2022-05-20T12:23, 'None', '']
More Overview Stats 21 ['738807903', 2021-07-30T21:13, 'None', '']
No Space Dash Prevents you from seeing answers without reading a question ['1409134430', 2020-12-25T09:49, '20.12.25i94', mod]
OpenInExternalEditorRenameDuplicate for ImageAudioVideo ['1560623518', 2022-09-18T01:03, 'None', mod]
Opening the same window multiple time ['354407385', 2020-05-16T02:59, 'None', '']
Pop-up Dictionary beta ['153625306', 2019-08-09T18:26, 'None', '']
Progress Graphs and Stats for Learned and Matured Cards ['266436365', 2020-03-29T08:26, 'None', '']
Puppy Reinforcement ['1722658993', 2020-03-03T08:49, 'None', '']
Push Paradox Sibling Cardistry ['1797395052', 2020-04-04T06:40, 'None', '']
Refocus Card when Reviewing 21 ['1642550423', 2019-11-14T23:00, 'None', '']
Remove Cloze Button and Hotkey ['1966460736', 2022-05-21T12:29, 'None', '']
Search Bar ['1251668918', 2020-09-09T23:55, 'None', '']
Search in formatted text in any fields ['1126516755', 2021-10-16T19:37, 'None', mod]
SearchFilter Bar Command Palette for Context Menus ['1842492261', 2021-12-11T00:18, 'None', '']
Semantic HTML tags in editor ['844409145', 2019-03-20T23:26, 'None', mod]
Small Potatoes Show learning step count in days ['75718778', 2020-04-02T20:53, 'None', '']
Special Fields ['1102281552', 2022-02-23T18:27, 'None', '']
Stats Overview Pie Graph with Distinct Learning and-or Relearning Sections ['1828603731', 2019-08-14T07:50, 'None', '']
Tab Indentation ['544286375', 2022-05-21T10:29, 'None', '']
Tags are mandatory to add a card ['1116519045', 2020-05-02T12:17, 'None', '']
Text Rendering Fix ['94394764', 2018-11-01T13:48, 'None', '']
Throughput Historical ['485345973', 2019-08-17T23:17, 'None', '']
Transfer scheduling data from one card to another ['94685914', 2020-09-18T11:23, 'None', '']
True Retention ['613684242', 2017-11-19T21:43, 'None', '']
True Tag Replacer ['803159801', 2021-02-28T11:07, 'None', '']
add-on dialog searchfilter bar ['561945101', 2021-12-05T21:28, 'None', '']
autoLapseNewInterval ['372281481', 2022-09-15T13:33, 'None', '']
avgEase for Anki 2141 ['1129477042', 2021-06-27T13:58, 'None', '']
confirm deletion ['263363568', 2019-04-13T13:21, 'None', '']
copy note contents to new Add window from Browser Reviewer Add EditCurrent ['759018284', 2022-08-16T12:28, 'None', mod]
deck and card info sidebar during review ['673114053', 2022-08-16T12:30, 'None', '']
extended editor for field for tables searchreplace ['805891399', 2022-03-13T11:51, 'None', mod]
noctrlq Ask before exitingquitting CtrlQ AltF4 ['973626898', 2020-09-05T15:08, '20.9.5i107', '']
remove linebreaks do word wrap ['2028179508', 2021-12-11T00:35, 'None', mod]
scheduler Reduce Interval growth for very mature cards ['9512376', 2020-08-08T16:33, 'None', mod]

===IDs of active AnkiWeb add-ons===
1052724801 1072815885 109531687 1102281552 1116519045 1126516755 1129477042 1167194350 1187737890 1210908941 1237621971 1251668918 1255924302 1369579727 1374772155 1409134430 1495282885 1535078906 153625306 1556734708 1560623518 1642550423 1672712021 1718996340 1722658993 175851166 1797395052 1828603731 1842492261 1949865265 1966460736 2028179508 2055492159 208879074 2123044452 2133933791 225180905 24411424 263363568 266436365 291119185 295889520 308574457 32017685 354407385 363320830 372281481 413416269 46611790 485345973 511710206 519936472 538879081 544286375 561945101 594329229 613684242 656021484 673114053 699175524 704320065 714624709 738807903 75718778 759018284 803159801 805891399 831846358 844409145 877182321 909480379 94394764 94685914 9512376 973626898 992153575 993120073 998250600

BTW, thanks for adding an easy config!

Anki 2.1.26 error on startup

Debug info:
Anki 2.1.26 (70784154) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2020-09-16 14:05:46

Caught exception:
Traceback (most recent call last):
File "aqt\main.py", line 253, in onOpenProfile
File "aqt\main.py", line 398, in loadProfile
File "aqt\gui_hooks.py", line 1559, in call
File "lib\site-packages\anki\hooks.py", line 583, in runHook
File "C:\Users\mario\AppData\Roaming\Anki2\addons21\autoLapseNewInterval_init_.py", line 78, in adjLapse_startup
adjLapse_all(True) # Includes functions below
File "C:\Users\mario\AppData\Roaming\Anki2\addons21\autoLapseNewInterval_init_.py", line 69, in adjLapse_all
eval_lapsed_newIvl(silent)
File "C:\Users\mario\AppData\Roaming\Anki2\addons21\autoLapseNewInterval_init_.py", line 203, in eval_lapsed_newIvl
dconf = mw.col.decks.dconf
AttributeError: 'DeckManager' object has no attribute 'dconf'

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.