8000 added some TODO markers to code, indicating places for improvement · ababook/stanford-corenlp-python@f3e1212 · GitHub
[go: up one dir, main page]

Skip t 8000 o content

Commit f3e1212

Browse files
committed
added some TODO markers to code, indicating places for improvement
1 parent f3653f7 commit f3e1212

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

corenlp.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ def parse_parser_results(text):
8686
crexp = re.compile('\s(\d*)\s(\d*)\s\-\>\s(\d*)\s(\d*), that is')
8787
matches = crexp.findall(line)
8888
for src_i, src_pos, sink_i, sink_pos in matches:
89+
# TODO: src_i and sink_i correspond to the sentences.
90+
# this was built for single sentences, and thus ignores
91+
# the sentence number. Should be fixed, but would require
92+
# restructuring the entire output.
8993
print "COREF MATCH", src_i, sink_i
9094
src = tmp['words'][int(src_pos)-1][0]
9195
sink = tmp['words'][int(sink_pos)-1][0]
@@ -167,7 +171,10 @@ def _parse(self, text, verbose=True):
167171
# clean up anything leftover
168172
while True:
169173
try:
170-
ch = self._server.read_nonblocking (2000, 1)
174+
# the second argument is a forced delay (in seconds)
175+
# EVERY parse must incur.
176+
# TODO make this as small as possible.
177+
ch = self._server.read_nonblocking (4000, 0.3)
171178
except pexpect.TIMEOUT:
172179
break
173180

@@ -178,7 +185,7 @@ def _parse(self, text, verbose=True):
178185

179186
# anything longer than 5 seconds requires that you also
180187
# increase timeout=5 in jsonrpc.py
181-
max_expected_time = min(6, 3 + len(text) / 20.0)
188+
max_expected_time = min(5, 3 + len(text) / 20.0)
182189
if verbose: print "Timeout", max_expected_time
183190
end_time = time.time() + max_expected_time
184191
incoming = ""

0 commit comments

Comments
 (0)
0