diff --git a/bot/data.py b/bot/data.py index 3b1effd..e29c0a5 100644 --- a/bot/data.py +++ b/bot/data.py @@ -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(): diff --git a/bot/yomichan/glossary/daijirin2.py b/bot/yomichan/glossary/daijirin2.py index c42841c..71e06ad 100644 --- a/bot/yomichan/glossary/daijirin2.py +++ b/bot/yomichan/glossary/daijirin2.py @@ -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 diff --git a/bot/icons.py b/bot/yomichan/glossary/icons.py similarity index 100% rename from bot/icons.py rename to bot/yomichan/glossary/icons.py diff --git a/bot/yomichan/glossary/jitenon.py b/bot/yomichan/glossary/jitenon.py index ca76f19..a342214 100644 --- a/bot/yomichan/glossary/jitenon.py +++ b/bot/yomichan/glossary/jitenon.py @@ -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 diff --git a/bot/yomichan/glossary/smk8.py b/bot/yomichan/glossary/smk8.py index 8754a02..b49fc47 100644 --- a/bot/yomichan/glossary/smk8.py +++ b/bot/yomichan/glossary/smk8.py @@ -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 diff --git a/data/adobe/Adobe-Japan1_sequences.txt b/data/entries/adobe/Adobe-Japan1_sequences.txt similarity index 100% rename from data/adobe/Adobe-Japan1_sequences.txt rename to data/entries/adobe/Adobe-Japan1_sequences.txt diff --git a/data/adobe/override_glyphs.json b/data/entries/adobe/override_glyphs.json similarity index 100% rename from data/adobe/override_glyphs.json rename to data/entries/adobe/override_glyphs.json diff --git a/data/daijirin2/kana_abbreviations.csv b/data/entries/daijirin2/kana_abbreviations.csv similarity index 100% rename from data/daijirin2/kana_abbreviations.csv rename to data/entries/daijirin2/kana_abbreviations.csv diff --git a/data/daijirin2/phrase_readings.csv b/data/entries/daijirin2/phrase_readings.csv similarity index 100% rename from data/daijirin2/phrase_readings.csv rename to data/entries/daijirin2/phrase_readings.csv diff --git a/data/smk8/phrase_readings.csv b/data/entries/smk8/phrase_readings.csv similarity index 100% rename from data/smk8/phrase_readings.csv rename to data/entries/smk8/phrase_readings.csv diff --git a/data/variant_kanji.csv b/data/entries/variant_kanji.csv similarity index 100% rename from data/variant_kanji.csv rename to data/entries/variant_kanji.csv diff --git a/data/daijirin2/mdict_name_conversion.json b/data/mdict/name_conversion/daijirin2.json similarity index 100% rename from data/daijirin2/mdict_name_conversion.json rename to data/mdict/name_conversion/daijirin2.json diff --git a/data/smk8/mdict_name_conversion.json b/data/mdict/name_conversion/smk8.json similarity index 100% rename from data/smk8/mdict_name_conversion.json rename to data/mdict/name_conversion/smk8.json diff --git a/data/yomichan_metadata.json b/data/yomichan/index.json similarity index 100% rename from data/yomichan_metadata.json rename to data/yomichan/index.json diff --git a/data/yomichan_inflection_categories.json b/data/yomichan/inflection_categories.json similarity index 100% rename from data/yomichan_inflection_categories.json rename to data/yomichan/inflection_categories.json diff --git a/data/daijirin2/yomichan_name_conversion.json b/data/yomichan/name_conversion/daijirin2.json similarity index 100% rename from data/daijirin2/yomichan_name_conversion.json rename to data/yomichan/name_conversion/daijirin2.json diff --git a/data/smk8/yomichan_name_conversion.json b/data/yomichan/name_conversion/smk8.json similarity index 100% rename from data/smk8/yomichan_name_conversion.json rename to data/yomichan/name_conversion/smk8.json