@@ -66,7 +66,6 @@ def parse_parser_results(text):
66
66
if len (split_entry ) == 3 :
67
67
rel , left , right = map (lambda x : remove_id (x ), split_entry )
68
68
tmp ['tuples' ].append (tuple ([rel ,left ,right ]))
69
- print "\n " , rel , left , right
70
69
elif "Coreference links" in line :
71
70
state = 5
72
71
elif state == 5 :
@@ -132,9 +131,13 @@ def parse(self, text):
132
131
with one dictionary entry for each parsed sentence, in JSON format.
133
132
"""
134
133
print "Request" , text
135
- print self ._server .sendline (text )
136
- # How much time should we give the parser to parse it?it
137
- #
134
+ self ._server .sendline (text )
135
+ # How much time should we give the parser to parse it?
136
+ # the idea here is that you increase the timeout as a
137
+ # function of the text's length.
138
+
139
+ # anything longer than 5 seconds requires that you also
140
+ # increase timeout=5 in jsonrpc.py
138
141
max_expected_time = min (5 , 2 + len (text ) / 200.0 )
139
142
print "Timeout" , max_expected_time
140
143
end_time = time .time () + max_expected_time
@@ -165,11 +168,8 @@ def parse(self, text):
165
168
'-H' , '--host' , default = '127.0.0.1' ,
166
169
help = 'Host to serve on (default localhost; 0.0.0.0 to make public)' )
167
170
options , args = parser .parse_args ()
168
- #parser.print_help()
169
171
server = jsonrpc .Server (jsonrpc .JsonRpc20 (),
170
172
jsonrpc .TransportTcpIp (addr = (options .host , int (options .port ))))
171
-
4E9E
corenlp = StanfordCoreNLP ()
172
- server .register_function (corenlp .parse )
173
- #server.register_instance(StanfordCoreNLP())
173
+ server .register_instance (StanfordCoreNLP ())
174
174
print 'Serving on http://%s:%s' % (options .host , options .port )
175
175
server .serve ()
0 commit comments