Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions corenlp/corenlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def parse_xml_output(input_dir, corenlp_path=DIRECTORY, memory="3g", raw_output=
# result = []
try:
for output_file in os.listdir(xml_dir):
with open(os.path.join(xml_dir + output_file), 'r') as xml:
with open(os.path.join(xml_dir, output_file), 'r') as xml:
# parsed = xml.read()
file_name = re.sub('.xml$', '', os.path.basename(output_file))
# result.append(parse_parser_xml_results(xml.read(), file_name,
Expand Down Expand Up @@ -314,22 +314,22 @@ def _spawn_corenlp(self):
self.corenlp = pexpect.spawn(self.start_corenlp, maxread=8192,
searchwindowsize=80)

# show progress bar while loading the models
if VERBOSE:
widgets = ['Loading Models: ', Fraction()]
pbar = ProgressBar(widgets=widgets, maxval=5, force_update=True).start()
# Model timeouts:
# pos tagger model (~5sec)
# NER-all classifier (~33sec)
# NER-muc classifier (~60sec)
# CoNLL classifier (~50sec)
# PCFG (~3sec)
timeouts = [20, 200, 600, 600, 20]
for i in xrange(5):
self.corenlp.expect("done.", timeout=timeouts[i]) # Load model
pbar.update(i + 1)
self.corenlp.expect("Entering interactive shell.")
pbar.finish()
# # show progress bar while loading the models
# if VERBOSE:
# widgets = ['Loading Models: ', Fraction()]
# pbar = ProgressBar(widgets=widgets, maxval=5, force_update=True).start()
# # Model timeouts:
# # pos tagger model (~5sec)
# # NER-all classifier (~33sec)
# # NER-muc classifier (~60sec)
# # CoNLL classifier (~50sec)
# # PCFG (~3sec)
# timeouts = [20, 200, 600, 600, 20]
# for i in xrange(5):
# self.corenlp.expect("done.", timeout=timeouts[i]) # Load model
# pbar.update(i + 1)
# self.corenlp.expect("Entering interactive shell.")
# pbar.finish()

# interactive shell
self.corenlp.expect("\nNLP> ")
Expand Down