solve problerms with menaing trasnlations,
mightneed to change trasnlation engine
This commit is contained in:
@@ -12,7 +12,7 @@ from genanki import Deck, Model, Note, Package
|
||||
from pinyin_tone_converter.pinyin_tone_converter import PinyinToneConverter
|
||||
|
||||
# Local
|
||||
from .constants import DICTATION_TYPE, DICT_TYPE, PHRASES_TYPE
|
||||
from .constants import COMPLETED_TYPE, DICTATION_TYPE, DICT_TYPE, PHRASES_TYPE
|
||||
from .utility import (
|
||||
DictionaryResult,
|
||||
ProcessFile,
|
||||
@@ -377,8 +377,22 @@ def output_anki_package(
|
||||
)
|
||||
deck.add_note(note)
|
||||
audios.append(result.audio_path)
|
||||
elif process_file.file_type is COMPLETED_TYPE:
|
||||
for result in results:
|
||||
note = Note(
|
||||
model=SIMPLE_HSK_MODEL,
|
||||
fields=[
|
||||
result.meaning,
|
||||
PinyinToneConverter().convert_text(result.pinyin),
|
||||
result.character,
|
||||
f"[sound:{result.audio_path.name}]",
|
||||
],
|
||||
)
|
||||
deck.add_note(note)
|
||||
audios.append(result.audio_path)
|
||||
decks.append(deck)
|
||||
package = Package(decks)
|
||||
package.media_files = audios
|
||||
package.write_to_file(final_file)
|
||||
return final_file
|
||||
if decks:
|
||||
package = Package(decks)
|
||||
package.media_files = audios
|
||||
package.write_to_file(final_file)
|
||||
return final_file
|
||||
|
||||
Reference in New Issue
Block a user