@@ -127,13 +127,13 @@ class StanfordCoreNLP(object):
127
127
Command-line interaction with Stanford's CoreNLP java utilities.
128
128
Can be run as a JSON-RPC server or imported as a module.
129
129
"""
130
- def __init__ (self , corenlp_path = None ):
130
+ def __init__ (self , corenlp_path = None , corenlp_version = '3.4.1' ):
131
131
"""
132
132
Checks the location of the jar files.
133
133
Spawns the server as a process.
134
134
"""
135
- jars = ["stanford-corenlp-3.4.1. jar" ,
136
- "stanford-corenlp-3.4.1 -models.jar" ,
135
+ jars = ["stanford-corenlp-%s. jar" % corenlp_version ,
136
+ "stanford-corenlp-%s -models.jar" % corenlp_version ,
137
137
"joda-time.jar" ,
138
138
"xom.jar" ,
139
139
"jollyday.jar" ]
@@ -252,11 +252,13 @@ def parse(self, text):
252
252
help = 'Host to serve on (default: 127.0.0.1. Use 0.0.0.0 to make public)' )
253
253
parser .add_option ('-P' , '--path' , default = None ,
254
254
help = 'Path to the dir containing the Stanford parser .jar file' )
255
+ parser .add_option ('-cv' , '--corenlp-version' , default = '3.4.1' ,
256
+ help = 'CoreNLP version' )
255
257
options , args = parser .parse_args ()
256
258
server = jsonrpc .Server (jsonrpc .JsonRpc20 (),
257
259
jsonrpc .TransportTcpIp (addr = (options .host , int (options .port ))))
258
260
259
- nlp = StanfordCoreNLP (options .path )
261
+ nlp = StanfordCoreNLP (options .path , options . corenlp_version )
260
262
server .register_function (nlp .parse )
261
263
262
264
logger .info ('Serving on http://%s:%s' % (options .host , options .port ))
0 commit comments