/dank-sinatra

Language learning tool. Makes a CSV out of English/German sentence pairs. Easily importable into Anki deck.

Primary LanguagePython

dank-sinatra

Language learning tool.
Makes a CSV file out of English/German sentence pairs, so that they are easily importable into Anki.

Context:

  • When I read books in my L2 (German), I write down sentences I find interesting and would like to remember.
  • I enter those sentences into https://www.deepl.com/translator (the left-hand side), and they get translated (on the right-hand side) like so: DeepL
  • I manually have to copy and paste all these German sentences along with their translation in my Anki deck. With a lot of sentences, this can get time-consuming. DeepL Example Anki
  • FEAR NOT. THERE IS A BETTER WAY! Anki supports importing CSV data.
  • This program will prompt you to input the name of your desired text file, and will generate a CSV file of German/English sentence pairs.
    Say you named your text file: batch.txt
    Running program and inputting
  • The format of the text file THAT YOU WOULD INPUT (i.e. place text file on same directory as program) should look like this:
    Text file format
    Copy and paste the English lines (left-hand side of DeepL) and place above divider.
    Copy and paste the German lines (right-hand side of DeepL) and place below divider.
    NOTE: FOR NOW, THE DIVIDER MUST BE EXACTLY THIS: --------
  • The generated CSV file looks something like:
    CSV file format
    English sentences on first column.
    German translated sentences on second column.
    EACH PAIR SEPARATED BY A COMMA.
  • Then on Anki, import the generated CSV file:
    Import button
    Look for generated file
    Proper settings
    Make sure that the field separator is set to a comma!
  • After clicking 'import', you would have successfully made these cards and added them into your Anki deck.

Notes:

  • This doesn't necessarily have to be in German, DeepL doesn't necessarily need to be used. It just has to follow the text file format.
  • German doesn't necessarily have to be at the back, English doesn't necessarily have to be at the front. Simply change the order of the text file input. (i.e. English sentences above divider, German sentences below.. or manipulate Anki fields when importing).
  • This only supports the very basic front/back plain text-only format. No additional fields, styling texts, audio files, images, etc. If you're interested in having that functionality for this, feel free to submit a PR.