Skip to content

Commit

Permalink
system.zip is handled properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Bikatr7 committed Nov 6, 2023
1 parent c667764 commit d47f46c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion handlers/sudachiHandler.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
## built-in imports
from __future__ import annotations ## used for cheating the circular import issue that occurs when i need to type check some things
from enum import Enum
from zipfile import ZipFile
from tempfile import NamedTemporaryFile
from time import sleep

import os
import csv
import subprocess
from tempfile import NamedTemporaryFile
import typing
import json

Expand Down Expand Up @@ -151,6 +153,13 @@ def __init__(self, replacement_json:dict, preloader:preloader, inc_katakana_hand

self.katakana_handler = inc_katakana_handler

if(os.path.exists(self.preloader.sudachi_system_dic) == False):

with ZipFile(self.preloader.system_zip, 'r') as zip_ref:
zip_ref.extractall(self.preloader.dic_lib)

sleep(.1)

##--------------------start-of-prepare_sudachi()------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

def prepare_sudachi(self, name_of_replacement_json:str) -> None:
Expand Down
2 changes: 2 additions & 0 deletions modules/preloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def __init__(self) -> None:
self.error_log_path = os.path.join(self.file_handler.output_dir, "error log.txt") ## path for the error log (errors generated by the preprocessing and translation modules)
self.debug_log_path = os.path.join(self.file_handler.output_dir, "debug log.txt") ## path for debug log (text generated by the translation modules to help with debugging)

self.system_zip = os.path.join(self.dic_lib, "system.zip")

self.katakana_words_path = os.path.join(self.sudachi_lib, "katakana_words.txt")
self.sudachi_config_json = os.path.join(self.sudachi_lib, "sudachi.json")
self.sudachi_system_dic = os.path.join(self.dic_lib, "system.dic")
Expand Down

0 comments on commit d47f46c

Please sign in to comment.