2020-11-04 18:02:15 +00:00
|
|
|
import argparse
|
|
|
|
|
|
|
|
import classla
|
|
|
|
from classla import Document
|
|
|
|
from classla.models.common.conll import CoNLLFile
|
|
|
|
|
2021-03-01 14:00:25 +00:00
|
|
|
import structure_assignment.pipeline as pipeline
|
2020-11-04 18:02:15 +00:00
|
|
|
|
|
|
|
arg_parser = argparse.ArgumentParser(description='Parse Slovene strings and convert to TEI.')
|
|
|
|
arg_parser.add_argument('-inlist', type=str, help='Input list file')
|
|
|
|
arg_parser.add_argument('-outtei', type=str, help='Output TEI file')
|
|
|
|
arguments = arg_parser.parse_args()
|
2020-11-10 13:07:44 +00:00
|
|
|
input_file_name = arguments.inlist
|
|
|
|
output_file_name = arguments.outtei
|
2020-11-04 18:02:15 +00:00
|
|
|
|
|
|
|
def run_pipeline(input_file_name, output_file_name):
|
2021-03-01 14:00:25 +00:00
|
|
|
pipeline.initialise(temp_dir='/tmp/structure_assignment_pipeline1', resource_dir='../resources')
|
2021-03-01 14:56:36 +00:00
|
|
|
pipeline.import_file(input_file_name, 'strings-list')
|
2021-03-01 14:00:25 +00:00
|
|
|
pipeline.do_tokenise()
|
|
|
|
pipeline.do_tweak_conllu()
|
2021-03-01 15:04:01 +00:00
|
|
|
pipeline.load_classla_models()
|
2021-03-01 14:00:25 +00:00
|
|
|
pipeline.do_parse()
|
|
|
|
pipeline.do_translate_jos()
|
|
|
|
pipeline.do_conllu_to_tei()
|
2021-03-01 14:56:36 +00:00
|
|
|
pipeline.export_file(output_file_name, 'tei-initial')
|
2021-03-01 14:00:25 +00:00
|
|
|
|
|
|
|
if (__name__ == '__main__'):
|
|
|
|
run_pipeline(input_file_name, output_file_name)
|