forked from CompLin/nheengatu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
39 lines (32 loc) · 968 Bytes
/
main.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
30
31
32
33
34
35
36
37
38
39
from src.common_paths import module_path
import src.Nheengatagger as nh
import sys
import os, sys, datetime
from src.BuildDictionary import loadLexicon
from src.common_paths import module_path
import src.common_paths as cp
import argparse
def handle_args():
"""tmp function to show how the command lines interaction could be used"""
parser = argparse.ArgumentParser(
prog="nheengatu",
description="Automatically POS-tagged by Nheengatagger",
epilog="Text at the bottom of help",
)
parser.add_argument("infile")
return parser
def main():
parser = handle_args()
args = parser.parse_args()
DICTIONARY = nh.buildDictionary(cp.LEXICON_PATH)
WE = nh.extractMWEs(DICTIONARY)
print(cp.MESSAGE)
lines = []
try:
with open(args.infile) as f:
lines = f.readlines()
nh.tagText(lines)
except FileNotFoundError as e:
print(e)
if __name__ == "__main__":
main()