π Hey there! Welcome to my language learning helper project! π
This whole thing started because I wanted a better way to learn German (my current language adventure!). Since I use Obsidian for all my notes and Anki for flashcards, I began crafting these little scripts to bridge the gap.
Over time, they grew and evolved a lot β tweaking, fixing, and improving until they became the handy tools you see today. I realized others might find them useful too, especially fellow Persian speakers diving into German. So, why keep them to myself? Sharing is caring! π
Looking ahead: Once I hit my own German goals, Iβd love to expand this into a multilingual helper, supporting way more languages than just Persian and German. The dream is big!
For now though? Below is the project exactly as it is β my little labor of love, ready for you to explore, use, and maybe even improve. Hope it helps you like it helped me!
A comprehensive toolkit for learning German that combines automated translation, audio pronunciation, and flashcard generation. This project streamlines the process of creating study materials by extracting definitions, examples, and audio from online sources and formatting them into structured markdown notes and Anki flashcards.
- π₯οΈ Modern GUI Application with dark theme and intuitive interface
- π¦ Standalone Executable - no Python installation required
- π€ Automated translation of German words to English and Persian
- π Audio pronunciation downloads from online dictionaries (CLI version)
- π Extraction of detailed definitions, synonyms, antonyms, and example sentences (CLI version)
- π Markdown-formatted study notes with proper German capitalization
- π΄ Conversion of notes to Anki flashcards with beautiful formatting
- π Support for example sentences and contextual usage
- π Dark mode support for Anki cards
- π€ Extract examples from Obsidian notes for focused study
- π Cross-platform compatibility (Windows, macOS, Linux)
The project is organized as a Python package with the following structure:
learning_german/
βββ config/ # Configuration settings
βββ gui/ # Modern GUI application with CustomTkinter
βββ templates/ # Anki card templates and styles
βββ utils/ # Utility functions
β βββ de_pronunciation_retriever.py # Audio download functionality
β βββ fa_definition_retriever.py # Persian definitions retrieval
β βββ text_processing.py # Text processing utilities
βββ anki_deck_generator.py # Convert markdown to Anki cards
βββ markdown_note_generator.py # Full-featured markdown generator (CLI)
βββ simple_markdown_generator.py # Simplified generator for standalone app
βββ obsidian_words_and_examples_extractor.py # Extract examples from Obsidian notes
- No requirements! Just download and run the executable
- Available for Windows (.exe) and macOS (.app)
- Python 3.6+
- Required Python packages:
- customtkinter: Modern GUI framework
- genanki: For creating Anki decks
- deep-translator: For translating German words
- requests: For making HTTP requests
- beautifulsoup4: For parsing HTML content
- aiohttp & aiofiles: For asynchronous operations
-
Download the latest release for your platform:
- Windows:
GermanLearningTools.exe - macOS:
GermanLearningTools.app
- Windows:
-
Run the application:
- Windows: Double-click the
.exefile - macOS: Double-click the
.appfile (if blocked, runxattr -rd com.apple.quarantine GermanLearningTools.app)
- Windows: Double-click the
-
Clone this repository:
git clone https://github.com/a-endari/Learning_German.git cd Learning_German -
Install the package and its dependencies:
pip install -e .Or using pipenv:
pipenv install
Simply double-click the downloaded executable! The modern GUI interface provides:
- π¨ Dark theme with purple accents and rounded corners
- π Text input area for German words (one per line)
- π Translation options: Persian & English, English Only, or Persian Only
- π Voice selection: German, Austrian German, or Swiss German
- π Output folder selection with automatic folder opening
- β
Checkboxes to choose what to generate:
- π Obsidian Markdown (.md) files
- π΄ Anki Deck (.apkg) files
- π One-click generation with progress tracking
For development or if you prefer running from source:
german-guiOr run the launcher directly:
python launch_gui.pyCreate a file named input.md in the data_files/input/ directory with your German vocabulary:
# Animals
der Hund
die Katze
das Pferd
> Der Hund spielt mit der Katze.
-
Headers: Lines starting with
#are treated as section headers:# Animals -
Words with Articles: Include the article for nouns (der, die, das):
der Tisch die Katze das Haus -
Example Sentences: Lines starting with
>are treated as example sentences:> Ich habe einen Hund. -
Words with Additional Information: You can include additional information after commas or hyphens:
der Tisch, table die Katze - catThe script will only process the part before the comma/hyphen.
-
Words with Asterisks: Asterisks at the end of words are automatically removed:
der Tisch*
Run the markdown note generator using the installed command-line tool:
german-translateOr run the module directly:
python -m learning_german.markdown_note_generatorThis will:
- Process each word in your input file
- Translate words to English and Persian
- Download audio pronunciations
- Extract detailed Persian definitions and synonyms
- Generate a formatted markdown file in
data_files/output/output.md
The generated output.md file will contain:
-
Word entries formatted as collapsible callouts with translations:
> [!tldr]- der Tisch > ![[Tisch.wav]] > table > Ω ΫΨ² > --- (Persian definition here) -
Example sentences formatted as warning callouts:
> [!warning]- π Beispiel Satz: > Das ist ein Tisch. > Ψ§ΫΩ ΫΪ© Ω ΫΨ² Ψ§Ψ³Ψͺ. -
Headers preserved as is:
# Furniture
Convert your markdown notes to Anki flashcards using the installed command-line tool:
german-to-anki data_files/output/output.md --deck-name "German Vocabulary"Or run the module directly:
python -m learning_german.anki_deck_generator data_files/output/output.md --deck-name "German Vocabulary"Parameters:
- First parameter: Path to the markdown file containing callouts
--deck-name(optional): Name for the Anki deck. If not provided, the filename without extension will be used
This will create an .apkg file in the data_files/output/ directory that you can import directly into Anki.
The generated Anki cards include:
- Front: German word with article
- Back:
- English translation
- Persian translation
- Persian definitions and examples
- Synonyms and antonyms (if available)
- Example sentences (if provided)
Reverse Cards: The system automatically creates reverse cards where:
- Front: Persian translation
- Back: German word
- Any example sentences are included on both card types
Example of generated Anki flashcard with translations and example sentences
If you have Obsidian notes with German vocabulary and examples, you can extract just the examples for focused study:
python -m learning_german.obsidian_words_and_examples_extractor path/to/your/obsidian_note.mdThis will:
- Extract example sentences (lines after "Beispiel" and "satz")
- Extract word entries (lines starting with "> [!tldr]- ")
- Create a text file with the same name as the input file but with a .txt extension in the output directory
- Run the markdown note generator to create
output.mdand audio files in theMediafolder - Copy
output.mdto your Obsidian vault - Copy the audio files from the
Mediafolder to your Obsidian vault's media folder - Open the note in Obsidian to see the formatted dictionary with playable audio
Example of German vocabulary notes in Obsidian with collapsible sections and audio playback Theme: catppuccin (Dark Mode)
- Collapsible Callouts: Words and definitions are organized in collapsible sections
- Audio Playback: Click on audio links to hear pronunciations
- Beautiful Formatting: Consistent styling makes studying more enjoyable
- Searchable Content: Easily find words and examples using Obsidian's search
To create your own standalone executables:
# Ensure you're in the project directory with virtual environment activated
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Run the build script
python build_app.pyThis will create:
- macOS:
dist/GermanLearningTools.app - Windows:
dist/GermanLearningTools.exe
You can modify settings in src/learning_german/config/settings.py:
INPUT_FILE: Path to your input markdown fileOUTPUT_FILE: Path where the generated markdown will be savedMEDIA_FOLDER: Folder for storing audio filesOUTPUT_DIR: Directory for Anki deck outputMIN_WORD_LENGTH: Minimum length for words to be processed
| Feature | Standalone App | CLI Version |
|---|---|---|
| Basic Translation | β | β |
| Audio Download | β | β |
| Persian Definitions | β | β |
| Synonyms/Antonyms | β | β |
| Modern GUI | β | β |
| No Python Required | β | β |
The standalone app uses a simplified generator for better compatibility with PyInstaller bundling.
If you want to add custom translations or definitions:
- Process your words normally
- Edit the generated
output.mdfile to add or modify translations - Convert to Anki cards as usual
The project includes comprehensive styling for Anki cards, including dark mode support. You can customize the appearance by modifying the CSS in src/learning_german/templates/anki_card_styles.py.
-
No Audio Found: Some words may not have audio available. The script will notify you and continue processing.
Solution: Try alternative spellings or check if the word exists in the online dictionary.
-
Translation Errors: Occasionally, translations may be inaccurate.
Solution: Edit the output markdown file before converting to Anki cards.
-
File Not Found Errors: Ensure your input file exists at the specified path.
Solution: Check the path in
settings.pyand make sure the file exists. -
Internet Connection Issues: The tool requires an internet connection for translations and audio.
Solution: Verify your internet connection and try again.
- Group Related Words: Use headers to organize words by topic
- Include Example Sentences: Add context to help with retention
- Review Regularly: Import cards into Anki and review daily
- Use Audio: Listen to pronunciations to improve your accent
- Add Your Own Notes: Customize cards with personal mnemonics
- Extract Examples: Use the example extractor to focus on sentence patterns
NOT IMPLEMENTED YET!
The project includes test files for various components:
tests/test_retrievers.py: Tests for pronunciation and definition retrievaltests/test_markdown_generator.py: Tests for markdown generationtests/test_anki_generator.py: Tests for Anki deck generation
Run tests using pytest:
pytestThe standalone executables are built using PyInstaller and include all necessary dependencies. Users can run the application without installing Python or any packages.
Output Folder/
βββ German_Vocabulary.md # Obsidian-formatted markdown
βββ [Deck Name].apkg # Anki flashcard deck
βββ Media/ # Audio files (CLI version only)
βββ word1.wav
βββ word2.wav
βββ ...
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Genanki for Anki package generation
- Deep Translator for translation capabilities
- BeautifulSoup for web scraping
- Obsidian for markdown note-taking capabilities
- aiohttp for asynchronous HTTP requests