diff --git a/.gitignore b/.gitignore index 9917d60..a5d6b31 100644 --- a/.gitignore +++ b/.gitignore @@ -41,4 +41,5 @@ media/ .DS_Store Thumbs.db -output/ \ No newline at end of file +output/ +data/ \ No newline at end of file diff --git a/README.md b/README.md index 700d457..3005780 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,6 @@ A Python tool to automatically generate Anki flashcards for language learning. uv run -m anki_generator --input words.csv --output deck.apkg ``` -## To do -- [ ] Add error logging -- [ ] Fix image rendering -- [ ] If word already exists, do not recreate cards \ No newline at end of file +## Enabling TTS + +See [Anki Manual](https://docs.ankiweb.net/templates/fields.html#text-to-speech-for-individual-fields). \ No newline at end of file diff --git a/anki_generator/card_generator.py b/anki_generator/card_generator.py index 1a8b81a..3836f23 100644 --- a/anki_generator/card_generator.py +++ b/anki_generator/card_generator.py @@ -53,7 +53,9 @@ class CardGenerator: { 'name': 'German Vocabulary Card', 'qfmt': ''' -
{{German_Word}}
+
+ {{German_Word}} {{tts de_DE:German_Word}} +
Part of speech: {{Part_of_Speech}}
Source: {{Source}}
{{Image}} @@ -64,7 +66,9 @@ class CardGenerator:
English meaning: {{English_Meaning}}
Article: {{Article}}
Plural Form: {{Plural_Form}}
-
Example: {{Example_Sentence}}
+
+ Example: {{Example_Sentence}} {{tts de_DE:Example_Sentence}} +
Translation: {{Sentence_Translation}}
Usage notes: {{Usage_Notes}}
Related words: {{Related_Words}}
diff --git a/anki_generator/models.py b/anki_generator/models.py index c60194a..87a7379 100644 --- a/anki_generator/models.py +++ b/anki_generator/models.py @@ -1,3 +1,4 @@ +import os from typing import List, Optional from pydantic import BaseModel, Field, HttpUrl from pydantic_settings import BaseSettings @@ -63,4 +64,4 @@ class AnkiCard(BaseModel): self.image.local_path if self.image else "", self.image.photographer if self.image else "", " ".join(self.word.tags) - ] \ No newline at end of file + ] diff --git a/data/words.csv b/data/words.csv index 65d905d..6755452 100644 --- a/data/words.csv +++ b/data/words.csv @@ -1,3 +1,8 @@ Bauch,Babbel Kopf,Babbel Rücken,Babbel +verlinken, Easy German 546: Die Brandmauer +Lieblingsthema, Easy German 546: Die Brandmauer +Zahnvorsorge, Easy German 546: Die Brandmauer +Vorsorgeuntersuchung, Easy German 546: Die Brandmauer +Untersuchung, Easy German 546: Die Brandmauer \ No newline at end of file