-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
executable file
·29 lines (22 loc) · 1.08 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3
'''
Author: Ondrej Mekota o(at)mkta.eu
'''
import logging
from tag import tag_lang_files
from align import align_book_files
from wordalign import word_align_book_files
import pipeline.utils as utils
if __name__=='__main__':
import argparse
parser = argparse.ArgumentParser(description='Run pipeline.')
parser.add_argument('-o','--output_dir', type=str, default='.', help='Directory to which to write the output files.')
parser.add_argument('-f', '--rewrite', action='store_true', help='Rewrite existing files.')
parser.add_argument('input', metavar='N', default=None, type=str, nargs='+', help='List of files to be processed. Format: NAME_LANG[_ID][.ext], for example Hobbit_eng.txt')
args = parser.parse_args()
config = utils.get_config()
book_files, lang_files = utils.parse_input_files(args.input, config)
# tag and align
tag_lang_files(lang_files, config, args.output_dir, args.rewrite)
align_book_files(book_files, args.output_dir, args.rewrite)
word_align_book_files(book_files, config, args.output_dir, args.rewrite)