Categorygithub.com/ap4y/leaf
repositorypackage
0.0.0-20200617025226-f32db495286d
Repository: https://github.com/ap4y/leaf.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

  • Leaf

Leaf is a flashcard app that uses [[https://en.wikipedia.org/wiki/Spaced_repetition][spaced repetition]] algorithm. Leaf focuses on simplifying database management, ease of access and support for various spaced repetition curves (including custom).

[[https://gitlab.com/ap4y/leaf/raw/master/screenshot.png]]

** Getting started

Leaf is a [[https://golang.org/][golang]] application and you are going to need golang toolchain to compile the app.

To install or update run:

#+BEGIN_SRC shell go get -u github.com/ap4y/leaf/cmd/leaf #+END_SRC

or

#+BEGIN_SRC shell go get -u github.com/ap4y/leaf/cmd/leaf-server #+END_SRC

Leaf provides 2 different versions:

  • leaf is a command line utility that provides review UI in the terminal
  • leaf-server is a web app that implements review UI along with additional features like stats viewer.

Both utilities have following configuration options:

  • -decks . is a path to a folder with deck files.
  • -db leaf.db is a location of a stats DB that contains spaced repetition variables for your decks.

For leaf-server you can also adjust address to start server on via -addr :8000.

Terminal CLI (leaf) has following commands:

  • review will initiate review session for a deck
  • stats will return stats snapshots for a deck

Both commands expect deck name after the command name. Full example:

#+BEGIN_SRC shell ./leaf -decks ./fixtures review Hiragana #+END_SRC

** Database management

Leaf uses plain text files structured usin [[https://orgmode.org/manual/Headlines.html#Headlines][org-mode headlines]]. Consider following file:

#+BEGIN_SRC org

  • Sample :PROPERTIES: :RATER: auto :ALGORITHM: sm2+c :PER_REVIEW: 20 :SIDES: answer :END: ** Question 1 Answer 1 ** Question 2 Answer 2 #+END_SRC

Such file will be parsed as a deck named Sample and it will have 2 cards. For a full deck example check [[https://gitlab.com/ap4y/leaf/raw/master/fixtures/hiragana.org][hiragana]] deck.

You can use text formatting, images, links and code blocks in your deck files. Check [[https://gitlab.com/ap4y/leaf/raw/master/fixtures/org-mode.org][org-mode]] deck for an overview of supported options.

Top header level property drawer is used to adjust review parameters. Following parameters are supported:

  • ALGORITHM is a spaced repetition algorithm to use. Default is sm2+c. All possible values can be found [[https://gitlab.com/ap4y/leaf/blob/master/stats.go#L35-44][here]].
  • RATER defines which rating system will be used for reviews. Defaults to auto, supported values: auto and self.
  • PER_REVIEW is a maximum amount of cards per review session.
  • SIDES is an optional field that defines names of the card sides, used in the UI for placeholders.

Spaced repetition variables are stored in a separate file in a binary database. You can edit deck files at any time and changes will be automatically reflected in the web app.

** Spaced repetition algorithms

Leaf implements multiple spaced repetition algorithms and allows you to define new ones. Following algorithms are supported as of now:

You can find calculated intervals in corresponding test files. Check [[https://gitlab.com/ap4y/leaf/blob/master/stats.go#L9-19][SRSAlgorithm]] interface to define a new algorithm or curve.

Please keep in mind that algorithm variables may not be compatible with each other and algorithm switching is not supported.

** Review rating

All reviews are rated using [0..1] scale. Rating higher than 0.6 will mark review as successful. You can use 2 different types of rating systems:

To change rating system for a deck define org-mode property RATER in your deck file.