open-spaced-repetition / py-fsrs

Python Package for FSRS
https://pypi.org/project/fsrs/
MIT License
147 stars 23 forks source link

How do I use this library? #27

Closed oschlueter closed 8 months ago

oschlueter commented 8 months ago

Hey!

Thank you for providing the means to build spaced repetition applications! I'd like to build a simple web app to repeat chess exercises and want to use your library for this purpose. Unfortunately, I have no idea how I would include it.

How can I create Card objects with my custom data?

Also, how do I store the result of a repetition set and load it again when I go for the next repetition?

I'd love to contribute a PR for a README and help others understand this quickly as well. Unfortunately, right now I don't understand it myself. Looking forward to your support!

L-M-Sherlock commented 8 months ago

How can I create Card objects with my custom data?

What's. your custom data? I recommend using Card only for scheduling and storing contents and other data in other table/object.

oschlueter commented 8 months ago

My custom data is a dictionary of strings, e.g. a chess position in FEN notation.

After practicing my chess, I could store the Card objects to disk but when I go again, the __init__ would set all member variables to 0. I suppose I would need to change the constructor of Card to load the data from the previous practice. What do you think?

L-M-Sherlock commented 8 months ago

You need to implement your own constructor, which is based on the database or ORM that you plan to use.

For example:

https://github.com/Pinafore/fact-repetition/blob/2bdcb801232dab5362610fa8297119dc5e9876f2/karl/models/feature_vector.py#L9-L38

oschlueter commented 8 months ago

Thank you for the advice! I finished my implementation. In case anyone else wants to take a look, you can find it here.

And thanks again for this wonderful library!