Skip to content

Takes in Q&A Cards in plaintext and turns them into Anki flashcards.

Notifications You must be signed in to change notification settings

Lastek/Ankiport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

File Format and Structure Documentation

Documentation generated with ChatGPT and edited by Lastek


  • See prompts.txt for how to generate cards with an LLM. I used deepseek.
  • Check cs430 example files for how it should look and to expect.

This document explains the file formats and structures required for the Anki card processing program. Follow these guidelines to correctly format input and tag files, and interpret the output.

How to use it

python ankiport.py <filename>.txt <tagsfilename>.txt

I suggest naming your tags <filename>_tags.txt to make things less confusing.

Cards File (<filename>.txt)

‼️ Must have .txt extension ‼️

Purpose: Contains the question-answer pairs to be processed.

Format:

Card #:
Q: [Question] for the question.
A: [Answer] for the answer.

Multi-line answers should be indented or separated by new lines.

Example:

Card #:
Q: What is the difference between logical schema and physical schema?  
A:
    Logical schema: The overall logical structure of the database (e.g., information about customers and accounts in a bank).  
    Physical schema: The overall physical structure of the database (how data is stored on disk).  

Tags File (<tagsfilename>.txt)

Purpose: Maps keywords in answers to corresponding tags.

Format:

  • A Python dictionary structure where:

    • Keys are keywords (case-insensitive).

    • Values are corresponding tags.

Example:

{
    "database": "database",
    "DBMS": "DBMS",
    "transaction": "transactions",
    "schema": "schema",
    "query": "query_processing"
}

Output File

Processed Cards File (<filename>_anki.txt)

Purpose: Contains the formatted cards ready for Anki import.

Format:

  • Each line represents one card, consisting of three tab-separated fields:
Question Answer Tags
Question Answer (multi-line content replaced with
tags).
Tags (space-separated).

Example:

What is a database?   A database is a large, integrated collection of data that models a real-world enterprise, including entities (e.g., students, courses) and relationships (e.g., Lady Gaga is taking CS 430).   database

How the Program Works

Input:

  • The program reads <filename>.txt for card data.

  • It reads <filename>_tags.txt for keyword-to-tag mapping.

Processing:

  • Replaces multi-line answers with <br> for Anki compatibility.

  • Matches keywords in answers to generate corresponding tags.

Output:

  • Writes the formatted cards with tags to <filename>_anki.txt.

Usage Instructions

  1. Prepare your input files:

  2. Create <filename>.txt with question-answer pairs.

  3. Create <filename>_tags.txt with the keyword-to-tag dictionary.@

  4. Run the program:

    • Ensure the script and files are in the same directory.

    • Ensure the script in a Python environment.

  5. Import into Anki:

    • Go into your deck and select File > Import.
    • Import the generated file and verify everything looks ok.

Notes

  • Modify tags.txt to adapt tags to your specific needs.

  • Ensure the input files follow the required structure for accurate processing.

Releases

No releases published

Packages

No packages published

Languages