Go to file
2023-09-08 12:19:33 +03:00
.gitignore Initial commit 2023-09-07 14:05:57 +03:00
csv2ankicards.py fixed comma extra fields issue 2023-09-07 14:20:31 +03:00
images2text.py Can convert, OCR and combine image files to text in parallel 2023-09-08 11:25:59 +03:00
README.md Updated README.md 2023-09-08 11:30:05 +03:00
requirements.txt Can convert from text to csv list of questions 2023-09-08 12:19:33 +03:00
text2csvdeck.py Can convert from text to csv list of questions 2023-09-08 12:19:33 +03:00

csv2ankicards

A simple toolkit that offers:

  • Conversion of CSV files into Anki deck packages (.apkg files).
  • Conversion of image files in a directory to a text file using Optical Character Recognition (OCR).

Features

  • Converts a CSV file with questions and answers into an Anki deck package.
  • Converts image files from a specified directory to a single text file using OCR.
  • For CSV: there are only two columns in the CSV file, separated by the first comma encountered.
  • CSV files should have a "Front" column for questions and a "Back" column for answers.

Installation

  1. Clone this repository:

    git clone https://git.rudefox.io/bj/anki-csv2ankicards.git
    cd csv2ankicards
    
  2. Set up a virtual environment and activate it:

    python3 -m venv venv
    source venv/bin/activate
    
  3. Install the required packages:

    pip install -r requirements.txt
    

Usage

CSV to Anki Conversion

To convert a CSV file into an Anki deck package:

python csv2ankicards.py /path/to/your/csvfile.csv output.apkg

This will produce an output.apkg file which can then be imported into Anki.

CSV Format

The CSV file should follow this format:

Front,Back
Your question here,Your answer here
Another question,list of: answer1, answer2, answer3
...

Note: If your answers contain commas, they will be considered as part of the answer. Only the first comma is used to separate the question from the answer.

Image to Text Conversion

To convert images from a directory to a single text file using OCR:

python images2text.py /path/to/your/image_directory/

This will produce a final.txt file which contains the text extracted from the images.

Supported Image Formats

Currently supported formats for the images are: .png, .jpg, and .jpeg.

License

MIT License

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.