Giter Club home page Giter Club logo

leerming's Introduction

leerming

Unlocking Understanding, One Card at a Time

Docker fuzzy-couscous Code style: black linting: pylint

Note

Alpha quality software!.

Description

Leerming is an open-source Django-based web app that follows the Leitner box method. Create flashcards effortlessly from PDFs, videos, and web links. Supercharge your learning experience.

Leitner Box Method

The Leitner box method is a simple yet effective technique for learning and retaining information. It works by organizing flashcards into different boxes or levels. As you study, correctly answered flashcards move to higher boxes, while incorrect ones move down. This spaced repetition system helps reinforce your memory over time.

For a more detailed explanation of the Leitner box method, check out Wikipedia.

Leitner Box Algorithm Implementation

  • Flashcards are organized into seven distinct levels. Each card starts at Level 1. The transition between levels is based on performance during reviews.

  • Each level corresponds to a specific number of days between reviews. For example, Level 1 cards are reviewed daily, while Level 2 cards are reviewed every two days. The exact mapping can be found in the codebase here.

  • During a review, when a card is answered correctly, it moves up to the next level. Once a card reaches Level 7, it is marked as mastered.

  • On the other hand, if a card is answered incorrectly during a review, it is downgraded to Level 1, regardless of its previous level. This ensures that challenging material is revisited frequently, while mastered content is reviewed less frequently.

Card Generation from Documents

Leerming can currently generate flashcards from web pages, YouTube videos, PDF files and Microsoft Word documents.

  1. Text Extraction: Uploaded documents, regardless of their original format, undergo automated text extraction, transforming the content into a common text format.

  2. Text Segmentation and Storage: The extracted text is divided into smaller, manageable chunks. For each chunk, we generate embeddings using OpenAI's models. These embeddings, along with the original text content, are then stored in a PostgreSQL database equipped with pgvector. This step is executed by a dedicated worker process.

  3. Key Question as Focal Point: Users provide a key question that serve as a central topic for generating flashcards. Additionally, users select one of their uploaded documents.

  4. Chunk Matching with L2Distance: Leerming identifies document chunks that are closest to the user's key question using L2Distance, ensuring the relevance of the generated flashcards.

  5. Prompt Generation with Language Models (LLM): Using the key question and the identified document chunks, Leerming generates an LLM prompt. This prompt is then sent to Language Models (LLM) to generate flashcards.

Local Development Setup

Requirements

Ensure you have the following prerequisites in place:

  • PostgreSQL database with the pgvector extension. If you use Docker, you can find a suitable image available.
  • Rye for streamlined dependency management. While not mandatory, it simplifies the process. You can use the requirements-dev.lock in the project root with any tool that supports the Python requirements.txt format.
  • An openai API key, you can get one at https://platform.openai.com/account/api-keys.

Setup and Run

Follow these steps to set up and run Leerming locally:

  1. Clone the repository: git clone https://github.com/tobi-de/leerming.git
  2. Navigate to the project directory: cd leerming
  3. Create and activate a virtual environment: rye shell
  4. Install dependencies: rye sync
  5. Create a .env file by copying from .env.template and fill it out: cp .env.template .env
  6. Apply migrations: python manage.py migrate
  7. Create the cache table: python manage.py createcachetable
  8. Install Watson for full-text search: python manage.py installwatson
  9. Create a superuser: python manage.py makesuperuser
  10. Start the development server: python manage.py runserver

leerming's People

Contributors

dependabot[bot] avatar sweep-ai[bot] avatar tobi-de avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

leerming's Issues

apply soft size limit to flashcard form

when the user type a question of more than 200 characters, remind them to keep it short, same for the answers, 150 characters

alpine or hyperscript for this

add tests

the mvp is mostly done at this point, tests are needed

New User Flow

  1. Landing Page.
  2. Sign Up View.
    • User clicks on the "Sign Up" button.
  3. Verification Email Sent View.
    • User is informed that a verification email has been sent.
  4. Email Verification View.
    • User clicks on the verification link from the email.
  5. Login View.
    • User logs in after email verification.
  6. Profile Setup View.
    • User sets up their profile with review_days and review_time.
  7. Dashboard View.
    • User is redirected to their dashboard, which initially displays an empty list of cards

Edit Cards

  1. Dashboard View.
  2. Search or Scroll to Locate Card View.
    • User locates a specific card.
  3. Select Card to Edit View.
    • User selects the card they want to edit.
  4. Edit Card Content View.
    • User edits card content (Front/Back or Fill in the Gap).
  5. Update Card Rank View.
    • User updates the card's rank.
  6. User can delete a card

Review Session

  1. Notification.
    • User receives a notification at the scheduled review time.
  2. Session Start View.
    • User clicks on the notification to start the session.
  3. Review Card View.
    • User goes through cards one by one.
  4. Answer Card View.
    • User attempts to answer the question.
    • Buttons: "Correct" and "Incorrect."
  5. Next Card View.
    • User proceeds to the next card.
  6. Session End View.
    • User completes all the cards for the current session.
  7. Score and Mastered Cards View.
    • User views session score and mastered cards.

Create New Cards Manually

  1. Dashboard View.
  2. Create Card View.
    • User clicks on the "Create New Card" button.
  3. Select Card Type View.
    • User chooses between "Front/Back Card" or "Fill in the Gap Card."
  4. Fill Card Form View.
    • User fills in card details (Front/Back or Fill in the Gap).
  5. Save Card View.
    • User saves the card.
  6. Navigate Between Cards View.
    • User can navigate between created cards.
  7. View and Edit Card View.
    • User can view answers and edit cards.

Create Cards from Document

  1. Dashboard View.
  2. Create Card View.
    • User clicks on the "Create New Card" button.
  3. Select Card Type View.
    • User chooses between "Front/Back Card" or "Fill in the Gap Card."
  4. Document Upload View.
    • User selects a document to create cards from.
  5. Generate Cards View.
    • User generates cards from the document.
  6. Navigate Between Generated Cards View.
    • User can navigate between generated cards.
  7. View and Edit Card View.
    • User can view answers and edit cards.

multi format support for document

Basic block of text

  • limit the size of the input
  • send the complete block to create card

Pdf or any other kind of doc (docx, html, txt, etc..)

  1. Get the text content from the file - https://llamahub.ai/l/file-unstructured
  2. Split the content into multiple documents - recursive text splitter
  3. Generate embedding for each document
  4. Save each document and their embedding in a UserDocumentChunk table
  5. Create a UserUpoadedDocument with the filename and use it to group all UserDocumentChunk together
  6. Use pgvector to get relevant documents to generate cards based on the user "Central quesion"

HTML

either save the content as an html file and use the same steps as for pdf since this https://llamahub.ai/l/file-unstructured support html, or use a specific loader for html https://llamahub.ai/l/web-unstructured_web

Youtube video

  1. Get the video transcript using https://llamahub.ai/l/youtube_transcript
    Use step 2 to 6 are the same as the pdf and docs

basic landing page

Something really simple so that early users understand what the app is about

tmp file does not exist

in prod the worker process and the main process do not run on the same container, worker do not have access to the temp file and fails to create documents

User Preferences

  1. Profile Settings View.
    • User accesses their profile settings. (short_name, full_name, review_days and review_time)
  2. Notification Preferences View.
    • User customizes notification preferences (method, frequency).

show an error messages if the LLM generate zero cards

Currently when no flashcards can be extracted from the LLM output a 404 page is showed to the user, add an error message that tell the user to retry, maybe with a slighly different question or a different card type.

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.