This repository has been archived by the owner on Aug 15, 2020. It is now read-only.
forked from mit-medg/CliCon
-
Notifications
You must be signed in to change notification settings - Fork 103
/
cliner
executable file
·62 lines (44 loc) · 1.54 KB
/
cliner
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python
######################################################################
# CliNER - cliner #
# #
# Willie Boag [email protected] #
# #
# Purpose: Command Line Interface for working with cliner. #
######################################################################
import sys
import os
def main():
commands = ['train', 'predict', 'evaluate']
help_msg = \
'''
Usage: cliner [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
%s
''' % '\n '.join(commands)
# Is argument correct?
if len(sys.argv)<2 or sys.argv[1] not in commands or sys.argv[1] == '--help':
sys.stderr.write('%s\n\n'%(help_msg))
exit(1)
# select appropriate sub-command
subcmd = sys.argv[1]
del sys.argv[1]
# Where to import code from
homedir = os.path.dirname(os.path.abspath(__file__))
codedir = os.path.join(homedir, 'code')
if codedir not in sys.path:
sys.path.append(codedir)
# Call appropriate sub-command
if subcmd == 'train':
import train
train.main()
elif subcmd == 'predict':
import predict
predict.main()
elif subcmd == 'evaluate':
import evaluate
evaluate.main()
if __name__ == '__main__':
main()