File tree Expand file tree Collapse file tree 2 files changed +36
-3
lines changed
Expand file tree Collapse file tree 2 files changed +36
-3
lines changed Original file line number Diff line number Diff line change 99 import plac
1010 import sys
1111 from wasabi import msg
12- from deep_reference_parser .train import train
13- from deep_reference_parser .predict import predict
12+ from .train import train
13+ from .predict import predict
1414
1515 commands = {
16- "train" : train ,
1716 "predict" : predict ,
17+ "train" : train ,
1818 }
1919
2020 if len (sys .argv ) == 1 :
Original file line number Diff line number Diff line change 1+ # coding: utf8
2+
3+ """
4+ Modified from https://github.com/explosion/spaCy/blob/master/spacy/__main__.py
5+
6+ """
7+
8+ if __name__ == "__main__" :
9+ import plac
10+ import sys
11+ from wasabi import msg
12+ from .numbered_reference_annotator import annotate_numbered_references
13+ from .prodigy_to_tsv import prodigy_to_tsv
14+ from .reach_to_prodigy import reach_to_prodigy
15+ from .reference_to_token_annotations import reference_to_token_annotations
16+
17+ commands = {
18+ "annotate_numbered_refs" : annotate_numbered_references ,
19+ "prodigy_to_tsv" : prodigy_to_tsv ,
20+ "reach_to_prodigy" : reach_to_prodigy ,
21+ "refs_to_token_annotations" : reference_to_token_annotations ,
22+ }
23+
24+ if len (sys .argv ) == 1 :
25+ msg .info ("Available commands" , ", " .join (commands ), exits = 1 )
26+ command = sys .argv .pop (1 )
27+ sys .argv [0 ] = "deep_reference_parser %s" % command
28+
29+ if command in commands :
30+ plac .call (commands [command ], sys .argv [1 :])
31+ else :
32+ available = "Available: {}" .format (", " .join (commands ))
33+ msg .fail ("Unknown command: {}" .format (command ), available , exits = 1 )
You can’t perform that action at this time.
0 commit comments