{"id":19332309,"url":"https://github.com/hhzl/learnwords2","last_synced_at":"2025-04-22T23:32:55.299Z","repository":{"id":13076572,"uuid":"73388739","full_name":"hhzl/LearnWords2","owner":"hhzl","description":"A word learning component (Leitner system) and word list conversion functions","archived":false,"fork":false,"pushed_at":"2022-12-04T21:28:48.000Z","size":2388,"stargazers_count":11,"open_issues_count":45,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-02T05:13:25.068Z","etag":null,"topics":["flashcards","leitner","spaced-repetition","vocabulary","vocabulary-flashcards"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hhzl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-10T14:18:44.000Z","updated_at":"2024-05-24T16:43:08.000Z","dependencies_parsed_at":"2022-09-06T22:14:18.939Z","dependency_job_id":null,"html_url":"https://github.com/hhzl/LearnWords2","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhzl%2FLearnWords2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhzl%2FLearnWords2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhzl%2FLearnWords2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhzl%2FLearnWords2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hhzl","download_url":"https://codeload.github.com/hhzl/LearnWords2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250340579,"owners_count":21414587,"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":["flashcards","leitner","spaced-repetition","vocabulary","vocabulary-flashcards"],"created_at":"2024-11-10T02:45:04.702Z","updated_at":"2025-04-22T23:32:54.858Z","avatar_url":"https://github.com/hhzl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LearnWords2\nA vocabulary learning component for flash cards implementing the Leitner system\n\n## Aim\n\nThe aim of the project is twofold\n1. Provide a JavaScript library called ``LW.js`` which maintains and uses a collection of vocabulary questions in a database. \"Database\" means here JSON data to be kept in the localStorage. A simple demo GUI is provided which illustrates how  ``LW.js`` is to be set up and used.\n2. Provide data conversion and report functions for lists of words to learn (the JSON files). This includes the conversion to the [Anki](https://apps.ankiweb.net/) file format.\n\n## What does the library ``LW.js`` implement?\nThe library offers a learning session which means that a certain number of questions is asked. The number is specified by a setting value. There are questions in the database which have never been asked, questions which are to be _learned_ and questions which are to be reviewed. \n\nA vocabulary question for review is  picked at random and then depending on the answer a new date is noted for the question to be asked again. The time interval increases if the question has been answered correctly. To do this a step (or level) value is maintained for each question to determine the time period after which the question might be asked again.\n\nThis is known as [spaced repetition](https://en.wikipedia.org/wiki/Spaced_repetition).\n![Leitner system](docs/230px-Leitner_system_alternative.svg.png)\n\nIt is as well possible to do the selection of questions according to tags given to each vocabulary entry.\n\nThe library implements the two lower levels as shown in the diagram:\n![learnwords2-layers](docs/LW2-context.png)\n\n\n## Reports\n\nThis repository includes [CLI](https://en.wikipedia.org/wiki/Command-line_interface) programs to generate HTML and LibreOffice Draw reports for  flash cards to be printed.\n\n\n\n# Setup and usage\n\n## Installation of the development environment\n\n\nInstallation of LearnWords2 repository\n\n````\t\ngit clone https://github.com/hhzl/LearnWords2.git\ncd LearnWords2\nnpm install\ngrunt\n````\n\nNote: \nThe ``grunt`` command generates the files in the ``dist`` directory. These JavaScript files are the debug and minified versions of the LearnWords2 library (``dist/LW.js`` and ``dist/LW-debug.js``). They are copied to the ``public/js`` directory so the demo and Jasmine tests are using the \"latest version\" (i.e. derived from the JavaScript in ``src``) of the library. The directory `public/data/json` contains the output data to be used by the library.\n\n\nNote2:\nThe generation of the browser version of the jasmine tests is currently disabled. Just use\n````\n    jasmine\n````\nto run the tests on the command line.\n\nDraft of more documentation [here](https://github.com/hhzl/LearnWords2/blob/master/docs/Developer_notes.md#2018-01-30). \n\n## Use of the library ``LW.js`` in client program\n\nTo use the library you just need to copy ``LW.js`` to the code repo of your app and add it as follows.\n\n```\n\u003cscript src=\"pathTo/LW.js\"\u003e\u003c/script\u003e\n```\nThe file ``public/demo.html`` illustrates this.\n\n\n## API 2 of ``LW.js``\n\n![learnwords2-layers](docs/learnwords2-layers.png)\n\n- LWdb is the data access layer.\n- LWBoxOfQuestions contains the logic for \"accessing and moving the cards\" (e.g. voculary entries) in the Leitner box\n\n\nCode:\n\n````JavaScript\n\"use strict\";\nvar lw = function(){\n\n\tvar db = LW.LWdb('learnWords');\n\n\tvar box = LW.BoxOfQuestions(db);\n         \n        // configuration\n\n        .......\n\n        box.importFrom(wordlist);\n\n\treturn box;\n}();\n\n````\n\nThe construction above (IIFE) returns the BoxOfQuestions object ready for use.\n\n\nIf there is no configuration of the db you could as well just do\n\n\n````JavaScript\nvar lw = LW.BoxOfQuestions(LW.LWdb('learnWords'));\n    lw.importFrom(wordlist);\n\n````\n\n\nThen access to everything goes through  ``lw.method()``.\n\n````JavaScript\n\nlw.importFrom(....);\n\nlw.question();\n\nlw.answer();\nlw.answerOptions();\n\nlw.moveQuestionBackwards();\n\nlw.moveQuestionForward();\n\n````\n\n \nNote: If `lw.moveQuestionBackwards()` and `lw.moveQuestionForward()` are called repeatedly on the same question it has only an effect the first time. The next time `lw.question()` is called a new question is provided.\n\nTODO: Add more usage examples and link to the full API description.\n\n\n## Input data\n\nInput data are CSV files with words and pictures in the directory `data/csv`.\n\n\n## Export data\n\nExport data in as HTML report and Anki database are generated and put into `public/data`.\nThe data to be used by the library is in `public/data/json`.\n\n\n\n## Specification and tests with Jasmine\n\n### In the browser\n\n- on the command line do\n\n     ```\n     grunt\n     ```\n\n- then a browser window will launch and bring you to a Jasmine test harness page\n  which is usually [http://localhost:8000](http://localhost:8000)\n\n\n### On the command line with node\n\n     npm test\n\n\n## Credits\n\nAnatol Marezhanyi, for the https://github.com/e1r0nd/LearnWords project\nwhich implements data storage, Leitner box mechanism and a GUI. That project is under reconstruction.\n\nThis project here is based on ideas and originally on code from LearnWords but has a different aim:\n1. It implements the non-gui part only to allow other projects to use the [SRS](https://github.com/repeat-space/srs-knowledge) and datastorage part as a library\n2. It adds data conversion functions to be used through a CLI for word list preparation and production of printed flash cards.\n3. Most of it is rewritten.\n4. It uses Jasmine tests.\n\n\n## Status\n\n* Jasmine specs are set up and work both in the browser and on the command line.\n* The LWdb (database layer) specification is set up and implemented with an MVP set of specs. \n* [release 0.2.2-beta](https://github.com/hhzl/LearnWords2/releases/tag/v0.2.2-beta) has a MVP implementation for the Leitner box and may be used for development work.\n* Documentation [update](https://github.com/hhzl/LearnWords2/blob/master/docs/Developer_notes.md) in progress\n* release 0.3.1 will come soon.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhhzl%2Flearnwords2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhhzl%2Flearnwords2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhhzl%2Flearnwords2/lists"}