https://github.com/lastek/ankiport
Takes in Q&A Cards in plaintext and turns them into Anki flashcards.
https://github.com/lastek/ankiport
anki anki-cards college python student studying studying-tool text-analysis text-summarization tool useful utility
Last synced: about 1 month ago
JSON representation
Takes in Q&A Cards in plaintext and turns them into Anki flashcards.
- Host: GitHub
- URL: https://github.com/lastek/ankiport
- Owner: Lastek
- Created: 2025-01-23T01:55:19.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-01-30T03:37:57.000Z (3 months ago)
- Last Synced: 2025-01-30T04:23:48.350Z (3 months ago)
- Topics: anki, anki-cards, college, python, student, studying, studying-tool, text-analysis, text-summarization, tool, useful, utility
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# File Format and Structure Documentation
> Documentation generated with ChatGPT and edited by Lastek
___
- [x] See `prompts.txt` for how to generate cards with an LLM. I used deepseek.
- [x] 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
```bash
python ankiport.py .txt .txt
```__I suggest naming your tags `_tags.txt` to make things less confusing.__
## Cards File (`.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 (`.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:
```python
{
"database": "database",
"DBMS": "DBMS",
"transaction": "transactions",
"schema": "schema",
"query": "query_processing"
}
```## Output File
Processed Cards File (`_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 `.txt` for card data.
- It reads `_tags.txt` for keyword-to-tag mapping.
Processing:
- Replaces multi-line answers with `
` for Anki compatibility.- Matches keywords in answers to generate corresponding tags.
Output:
- Writes the formatted cards with tags to `_anki.txt`.
## Usage Instructions
1. Prepare your input files:
2. Create `.txt` with question-answer pairs.
3. Create `_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.