{"id":26988346,"url":"https://github.com/open-spaced-repetition/fsrs-rs","last_synced_at":"2025-04-03T20:08:51.135Z","repository":{"id":188841616,"uuid":"679353662","full_name":"open-spaced-repetition/fsrs-rs","owner":"open-spaced-repetition","description":"FSRS for Rust, including Optimizer and Scheduler","archived":false,"fork":false,"pushed_at":"2025-04-01T12:11:49.000Z","size":977,"stargazers_count":219,"open_issues_count":2,"forks_count":24,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-02T12:53:31.525Z","etag":null,"topics":["fsrs","machine-learning","rust","spaced-repetition-algorithm"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/fsrs","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/open-spaced-repetition.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["open-spaced-repetition"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2023-08-16T16:40:37.000Z","updated_at":"2025-04-01T14:02:18.000Z","dependencies_parsed_at":"2024-04-18T05:25:18.485Z","dependency_job_id":"0efdb005-05d5-42b7-aba4-6cb76dce5d6b","html_url":"https://github.com/open-spaced-repetition/fsrs-rs","commit_stats":null,"previous_names":["open-spaced-repetition/fsrs-optimizer-burn","open-spaced-repetition/fsrs-optimizer-rs","open-spaced-repetition/fsrs-rs"],"tags_count":56,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-spaced-repetition%2Ffsrs-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-spaced-repetition%2Ffsrs-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-spaced-repetition%2Ffsrs-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-spaced-repetition%2Ffsrs-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/open-spaced-repetition","download_url":"https://codeload.github.com/open-spaced-repetition/fsrs-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247070923,"owners_count":20878586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fsrs","machine-learning","rust","spaced-repetition-algorithm"],"created_at":"2025-04-03T20:08:46.151Z","updated_at":"2025-04-03T20:08:51.113Z","avatar_url":"https://github.com/open-spaced-repetition.png","language":"Rust","funding_links":["https://github.com/sponsors/open-spaced-repetition"],"categories":["Implementation","Rust","Algorithms"],"sub_categories":[],"readme":"# FSRS for Rust\n\n[![crates.io](https://img.shields.io/crates/v/fsrs.svg)](https://crates.io/crates/fsrs) ![](https://github.com/open-spaced-repetition/fsrs-rs/actions/workflows/check.yml/badge.svg)\n\nThis crate contains a Rust API for training FSRS parameters, and for using them to schedule cards.\n\nThe Free Spaced Repetition Scheduler ([FSRS](https://github.com/open-spaced-repetition/fsrs4anki)) is a modern spaced repetition algorithm. It is based on the [DSR model](https://supermemo.guru/wiki/Three_component_model_of_memory) proposed by [Piotr Wozniak](https://supermemo.guru/wiki/Piotr_Wozniak), the creator of SuperMemo.\n\nFSRS-rs is a Rust implementation of FSRS. It is designed to be used in [Anki](https://apps.ankiweb.net/), a popular spaced repetition software. [Anki 23.10](https://github.com/ankitects/anki/releases/tag/23.10) has already integrated FSRS as an alternative scheduler.\n\nFor more information about the algorithm, please refer to [the wiki page of FSRS](https://github.com/open-spaced-repetition/fsrs4anki/wiki/The-Algorithm).\n\n---\n\n## Quickstart\n\nRead up [this](https://github.com/open-spaced-repetition/fsrs4anki/wiki/The-Optimal-Retention) to determine the optimal retention for your use case.\n\n```rust\n// Pick to your liking (see above)\nlet optimal_retention = 0.75;\n// Use default parameters/Weights for scheduler\nlet fsrs = FSRS::new(Some(\u0026[]))?;\n\n// Create a completely new card\nlet day1_states = fsrs.next_states(None, optimal_retention, 0)?;\n\n// Rate as `hard` on first day\nlet day1 = day1_states.hard;\ndbg!(\u0026day1); // scheduled as `in 4 days`\n\n// Now we review the card 2 days later\nlet day3_states = fsrs.next_states(Some(day1.memory), optimal_retention, 2)?;\n\n// Rate as `good` this time\nlet day3 = day3_states.good;\ndbg!(day3);\n```\n\n## Online development\n\ngo to \u003chttps://idx.google.com/import\u003e\n\n## Local development\n\nadd\n\n```sh\n#!/bin/sh\ncargo fmt\ncargo clippy -- -D warnings\ngit add .\n```\n\nto `.git/hooks/pre-commit`, then `chmod +x .git/hooks/pre-commit`\n\n## Bindings\n\n- python \u003chttps://github.com/open-spaced-repetition/fsrs-rs-python\u003e\n- nodejs \u003chttps://github.com/open-spaced-repetition/fsrs-rs-nodejs\u003e\n- dart \u003chttps://github.com/open-spaced-repetition/fsrs-rs-dart\u003e\n\n## Q\u0026A\n\n- What is the difference with [rs-fsrs](https://github.com/open-spaced-repetition/rs-fsrs)\n\n  If you want to schedule the card, use \\[lang\\]-fsrs or the [bindings](https://github.com/open-spaced-repetition/rs-fsrs?tab=readme-ov-file#bindings),\n\n  If you do the optimization, use this crate or its bindings.\n\n- Why not in one crate but two?\n\n  Calculating the weight involves tensor operations. So the initial data type is different(Tensor vs Vec/Slice). In one crate means use `cfg` to change type, which is tedious, so here we keep two versions.\n\n  Another reason is, other languages will be hard to port their version when `Tensor` is used.\n\n- What about the name?\n\n  At first, there are `go-fsrs` and other libraries, so `rs-fsrs` is used.\n\n  Then we want to port the torch version to rust so everyone can calculate on their own devices (tch-rs use libtorch which is too heavy), since the algorithm is called `fsrs`, add `-rs`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-spaced-repetition%2Ffsrs-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopen-spaced-repetition%2Ffsrs-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-spaced-repetition%2Ffsrs-rs/lists"}