def __init__(self, path):
logger.info("Dictionary(%s)", path)
self.__dict_base = {}
self.__dict = {}
self.__yomi = ''
self.__no = 0
self.__cand = []
self.__numeric = ''
self.__dirty = False
self.__orders_path = ''
# Load Katakana dictionary first so that Katakana words come after Kanji words.
katakana_path = os.path.join(os.getenv('IBUS_REPLACE_WITH_KANJI_LOCATION'), 'katakana.dic')
self.__load_dict(self.__dict_base, katakana_path)
# Load system dictionary
self.__load_dict(self.__dict_base, path)
# Load private dictionary
self.__dict = self.__dict_base.copy()
my_path = os.path.expanduser('~/.local/share/ibus-replace-with-kanji/my.dic')
self.__load_dict(self.__dict, my_path, 'a+')
base = os.path.basename(path)
if base:
self.__orders_path = os.path.expanduser('~/.local/share/ibus-replace-with-kanji')
self.__orders_path = os.path.join(self.__orders_path, base)
self.__load_dict(self.__dict, self.__orders_path, 'a+', version_checked=False)
评论列表
文章目录