structure_assignment/scripts/pipeline1.py

27 lines
937 B
Python

import argparse
from structure_assignment.pipeline import Pipeline, create_nlp
def run_pipeline(nlp, input_file_name, output_file_name):
pipeline = Pipeline(nlp)
pipeline.import_file(input_file_name, 'strings-list')
pipeline.do_tokenise()
pipeline.do_tweak_conllu()
pipeline.do_parse()
pipeline.do_translate_jos()
pipeline.do_conllu_to_tei()
pipeline.export_file(output_file_name, 'tei-initial')
pipeline.cleanup()
if (__name__ == '__main__'):
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()
input_file_name = arguments.inlist
output_file_name = arguments.outtei
nlp = create_nlp('../resources')
run_pipeline(input_file_name, output_file_name)