Reorganize data file directory

This commit is contained in:
stephenmk 2023-07-08 20:49:42 -05:00
parent 5c231fc6a0
commit 8855afb464
No known key found for this signature in database
GPG key ID: B6DA730DB06235F1
17 changed files with 13 additions and 13 deletions

View file

@ -37,14 +37,14 @@ def load_config():
@cache
def load_yomichan_inflection_categories():
file_name = "yomichan_inflection_categories.json"
file_name = os.path.join("yomichan", "inflection_categories.json")
data = __load_json(file_name)
return data
@cache
def load_yomichan_metadata():
file_name = "yomichan_metadata.json"
file_name = os.path.join("yomichan", "index.json")
data = __load_json(file_name)
return data
@ -53,7 +53,7 @@ def load_yomichan_metadata():
def load_variant_kanji():
def loader(data, row):
data[row[0]] = row[1]
file_name = "variant_kanji.csv"
file_name = os.path.join("entries", "variant_kanji.csv")
data = {}
__load_csv(file_name, loader, data)
return data
@ -65,7 +65,7 @@ def load_smk8_phrase_readings():
entry_id = (int(row[0]), int(row[1]))
reading = row[2]
data[entry_id] = reading
file_name = os.path.join("smk8", "phrase_readings.csv")
file_name = os.path.join("entries", "smk8", "phrase_readings.csv")
data = {}
__load_csv(file_name, loader, data)
return data
@ -77,7 +77,7 @@ def load_daijirin2_phrase_readings():
entry_id = (int(row[0]), int(row[1]))
reading = row[2]
data[entry_id] = reading
file_name = os.path.join("daijirin2", "phrase_readings.csv")
file_name = os.path.join("entries", "daijirin2", "phrase_readings.csv")
data = {}
__load_csv(file_name, loader, data)
return data
@ -92,7 +92,7 @@ def load_daijirin2_kana_abbreviations():
if abbr.strip() != "":
abbreviations.append(abbr)
data[entry_id] = abbreviations
file_name = os.path.join("daijirin2", "kana_abbreviations.csv")
file_name = os.path.join("entries", "daijirin2", "kana_abbreviations.csv")
data = {}
__load_csv(file_name, loader, data)
return data
@ -100,14 +100,14 @@ def load_daijirin2_kana_abbreviations():
@cache
def load_yomichan_name_conversion(target):
file_name = os.path.join(target.value, "yomichan_name_conversion.json")
file_name = os.path.join("yomichan", "name_conversion", f"{target.value}.json")
data = __load_json(file_name)
return data
@cache
def load_mdict_name_conversion(target):
file_name = os.path.join(target.value, "mdict_name_conversion.json")
file_name = os.path.join("mdict", "name_conversion", f"{target.value}.json")
data = __load_json(file_name)
return data
@ -131,7 +131,7 @@ def __load_adobe_glyphs():
data[code].append(character)
else:
data[code] = [character]
file_name = os.path.join("adobe", "Adobe-Japan1_sequences.txt")
file_name = os.path.join("entries", "adobe", "Adobe-Japan1_sequences.txt")
data = {}
__load_csv(file_name, loader, data, delim=';')
return data
@ -139,7 +139,7 @@ def __load_adobe_glyphs():
@cache
def __load_override_adobe_glyphs():
file_name = os.path.join("adobe", "override_glyphs.json")
file_name = os.path.join("entries", "adobe", "override_glyphs.json")
json_data = __load_json(file_name)
data = {}
for key, val in json_data.items():

View file

@ -4,7 +4,7 @@ from bs4 import BeautifulSoup
from functools import cache
from pathlib import Path
import bot.icons as Icons
import bot.yomichan.glossary.icons as Icons
from bot.soup import delete_soup_nodes
from bot.data import load_yomichan_name_conversion
from bot.yomichan.glossary.gloss import make_gloss

View file

@ -2,7 +2,7 @@ import re
import os
from bs4 import BeautifulSoup
import bot.icons as Icons
import bot.yomichan.glossary.icons as Icons
from bot.yomichan.glossary.gloss import make_gloss

View file

@ -2,7 +2,7 @@ import re
import os
from bs4 import BeautifulSoup
import bot.icons as Icons
import bot.yomichan.glossary.icons as Icons
from bot.soup import delete_soup_nodes
from bot.data import load_yomichan_name_conversion
from bot.yomichan.glossary.gloss import make_gloss