From f7d3e366f078a5691837808f50b2d3495159300b Mon Sep 17 00:00:00 2001 From: Nitsud Yarg Date: Mon, 22 Jun 2026 20:18:13 -0700 Subject: [PATCH] extracting help items from lotd dialogue --- make_help_notes.py | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 make_help_notes.py diff --git a/make_help_notes.py b/make_help_notes.py new file mode 100644 index 0000000..bb191cb --- /dev/null +++ b/make_help_notes.py @@ -0,0 +1,49 @@ +## This is just copied from make_dialog_notes.py +from fugashi_parser import * + +import os +from pathlib import Path +import shutil +import hashlib + +destination_directory_name = '/run/media/deck/YF8SD/Sync/Notebooks/Obsidian/Japanese/Yu-Gi-Oh/' +destination_path = Path(destination_directory_name) +vocab_destination_path = Path('/run/media/deck/YF8SD/Sync/Notebooks/Obsidian/Japanese/vocab') + +with open("helptext_dump.json", "r", encoding="utf-8") as f: + dump = json.load(f) + +if not destination_path.exists(): + destination_path.mkdir(parents=True, exist_ok=True) +if not destination_path.joinpath('YLOTD_help').exists(): + destination_path.joinpath('YLOTD_help').mkdir(parents=True, exist_ok=True) + +counter = 0 +destination_path = destination_path.joinpath('YLOTD_help') +with open(destination_path.as_posix() + f"/HelpText.md", 'w') as card_note: + for title in dump: + print(title) + counter+=1 + ## copy the image if it isn't already there + print(title) + card_note.write(f"\n") + #card_note.write(f"\n###### {title}\n\n") + #reformatted = re.sub(r'(\d{2})/(\d{2})/(\d{4})', r'\3-\1-\2', date) + #re.replace('\$R') + text_J = dump[title]['ja'] + text_J = re.sub(r'\$R(.*?)\((.*?)\)',r'\1\2',text_J) + if text_J[0] == '●': + card_note.write(f"#### {text_J}\n\n") + print(f"
{text_J}{dump[title]['en']}
",file=card_note) + text_J = dump[title]['ja'] + text_J = re.sub(r'\$R(.*?)\((.*?)\)',r'\1',text_J) + text_J = text_J.replace('
', '').replace('\n','') + ## print raw for vocab lookup + print(f"\n{text_J}\n", file=card_note) + vocab = {} ## flush the vocab variable each time + result = analyze(text_J, vocab) + print(f"> [!summary]- Vocab\n>{result['notes_link']}",file=card_note) + for word in vocab: + write_word_note(word, vocab_destination_path, vocab[word]['pos'][0]) + # ## add card names as properties +