|
|
|
@ -30,13 +30,12 @@ def __get_tmp_file_name(file_key):
|
|
|
|
|
return tmp_directory + '/' + FILE_NAME_MAP[file_key]
|
|
|
|
|
|
|
|
|
|
def initialise(**argument_map):
|
|
|
|
|
global tmp_directory, resource_directory, nlp
|
|
|
|
|
global tmp_directory, resource_directory
|
|
|
|
|
tmp_directory = argument_map['temp_dir']
|
|
|
|
|
resource_directory = argument_map['resource_dir']
|
|
|
|
|
shutil.rmtree(tmp_directory, True)
|
|
|
|
|
os.makedirs(tmp_directory, exist_ok=True)
|
|
|
|
|
NLP_CONFIG_MAP['models_dir'] = resource_directory + '/classla'
|
|
|
|
|
nlp = classla.Pipeline('sl', **NLP_CONFIG_MAP)
|
|
|
|
|
|
|
|
|
|
def import_file(file_name, file_key):
|
|
|
|
|
shutil.copyfile(file_name, __get_tmp_file_name(file_key))
|
|
|
|
@ -51,6 +50,10 @@ def do_tweak_conllu():
|
|
|
|
|
output_file_name = __get_tmp_file_name('obeliks-tweaked')
|
|
|
|
|
tweak_conllu(input_file_name, output_file_name)
|
|
|
|
|
|
|
|
|
|
def load_classla_models():
|
|
|
|
|
global nlp
|
|
|
|
|
nlp = classla.Pipeline('sl', **NLP_CONFIG_MAP)
|
|
|
|
|
|
|
|
|
|
def do_parse():
|
|
|
|
|
input_file_name = __get_tmp_file_name('obeliks-tweaked')
|
|
|
|
|
output_file_name = __get_tmp_file_name('classla-parsed')
|
|
|
|
|