import genanki import csv from gtts import gTTS import os my_model = genanki.Model( 1607392319, 'Kaishi 1.5k Model', fields=[ 'name': 'Kanji', 'name': 'Kana', 'name': 'English', 'name': 'Pitch', 'name': 'AudioWord', 'name': 'Example', 'name': 'ExampleKana', 'name': 'ExampleAudio', 'name': 'Frequency', ], templates=[
deck = genanki.Deck(2059400110, 'Kaishi 1.5k') with open('kaishi_1500.csv', 'r', encoding='utf-8') as f: reader = csv.DictReader(f) for row in reader: # Generate TTS audio (skip if you have real audio) word_audio = f"row['Kana'].mp3" if not os.path.exists(word_audio): tts = gTTS(row['Kana'], lang='ja') tts.save(word_audio)
'name': 'Card 1', 'qfmt': 'Kanji<br>Kana', 'afmt': 'FrontSide<hr>English<br>Pitch<br>AudioWord<br>Example<br>ExampleKana<br>ExampleAudio', , ])
| Field | Content | |-------|---------| | Kanji | 食べる | | Kana | たべる | | English | to eat | | Pitch | 2 | | AudioWord | [sound:eat.mp3] | | Example | ご飯を食べる。 | | ExampleKana | ごはんをたべる。 | | ExampleAudio | [sound:eat_ex.mp3] | | Frequency | 112 | Copy these rows into a .csv file (Excel or Notepad++), save as UTF-8, then import into Anki.