stuff
This commit is contained in:
parent
5eb0f88bc2
commit
c14eb1b4c4
28
append_vocab_tab.py
Normal file
28
append_vocab_tab.py
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
from fugashi_parser import *
|
||||||
|
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import shutil
|
||||||
|
import hashlib
|
||||||
|
|
||||||
|
vocab_destination_path = Path('/run/media/deck/YF8SD/Sync/Notebooks/Obsidian/Japanese/vocab')
|
||||||
|
|
||||||
|
pos_list = list()
|
||||||
|
for file_path in vocab_destination_path.iterdir():
|
||||||
|
if file_path.is_file(): # Ensure it's a file, not a subdirectory
|
||||||
|
pos = file_path.stem.split('_')[1]
|
||||||
|
pos_list.append(pos)
|
||||||
|
if CONTENT_LINK_TAG.get(pos):
|
||||||
|
#do a thing
|
||||||
|
with open(file_path, "a") as file:
|
||||||
|
#file.write("This text will be added to the end.")
|
||||||
|
print(f"#{CONTENT_LINK_TAG[pos]}", file=file)
|
||||||
|
else:
|
||||||
|
print(pos, ' - no tag')
|
||||||
|
|
||||||
|
# with file_path.open('r') as file:
|
||||||
|
# content = file.read()
|
||||||
|
# print(f"Content of {file_path.name}: {content}")
|
||||||
|
|
||||||
|
unique_values = list(set(pos_list))
|
||||||
|
print(unique_values)
|
||||||
|
|
@ -101,7 +101,11 @@ def term_entries(term :str) -> dict:
|
||||||
CONTENT_LINK_TAG = {
|
CONTENT_LINK_TAG = {
|
||||||
'名詞': 'meishi', # noun
|
'名詞': 'meishi', # noun
|
||||||
'動詞': 'doshi', # verb
|
'動詞': 'doshi', # verb
|
||||||
'形容詞': 'keiyoshi' # Adjective
|
'形容詞': 'keiyoshi', # Adjective
|
||||||
|
'形状詞': 'keijoshi', # form word
|
||||||
|
'代名詞':'daimeishi', # pronoun
|
||||||
|
'感動詞': 'kandoshi', # interjection
|
||||||
|
'副詞' : 'fukushi' # adverb
|
||||||
#'副詞' : 'fukushi' #adverb
|
#'副詞' : 'fukushi' #adverb
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -420,7 +424,7 @@ def write_word_note(word: str, destination_dir: Path, part_of_speech:str='', ove
|
||||||
vocab_note.write(entry['glossary-first'])
|
vocab_note.write(entry['glossary-first'])
|
||||||
#print("##### Other Definitions", file=vocab_note)
|
#print("##### Other Definitions", file=vocab_note)
|
||||||
print("\n", file=vocab_note)
|
print("\n", file=vocab_note)
|
||||||
# if CONTENT_LINK_TAG.get(part_of_speech, '') != '':
|
if CONTENT_LINK_TAG.get(part_of_speech, '') != '':
|
||||||
# print(f"#{CONTENT_LINK_TAG[part_of_speech]}", file=vocab_note)
|
print(f"#{CONTENT_LINK_TAG[part_of_speech]}", file=vocab_note)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user