@@ -122,19 +122,26 @@ class CoreNLPClient(RobustService):
122
122
DEFAULT_ANNOTATORS = "tokenize ssplit lemma pos ner depparse" .split ()
123
123
DEFAULT_PROPERTIES = {}
124
124
125
- def __init__ (self , start_server = True , endpoint = "http://localhost:9000" ,
126
- timeout = 5000 , annotators = DEFAULT_ANNOTATORS ,
127
- properties = DEFAULT_PROPERTIES , stdout = sys .stdout ,
128
- stderr = sys .stderr ):
125
+ def __init__ (self , start_server = True ,
126
+ endpoint = "http://localhost:9000" ,
127
+ timeout = 5000 ,
128
+ threads = 5 ,
129
+ annotators = DEFAULT_ANNOTATORS ,
130
+ properties = DEFAULT_PROPERTIES ,
131
+ stdout = sys .stdout ,
132
+ stderr = sys .stderr
133
+ ):
134
+
129
135
if start_server :
130
136
host , port = urlparse (endpoint ).netloc .split (":" )
131
137
assert host == "localhost" , "If starting a server, endpoint must be localhost"
132
138
133
139
assert os .getenv ("CORENLP_HOME" ) is not None , "Please define $CORENLP_HOME where your CoreNLP Java checkout is"
134
- start_cmd = "java -cp '{corenlp_home}/*' edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port {port} -timeout {timeout}" .format (
140
+ start_cmd = "java -cp '{corenlp_home}/*' edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port {port} -timeout {timeout} -threads {threads} " .format (
135
141
corenlp_home = os .getenv ("CORENLP_HOME" ),
136
142
port = port ,
137
- timeout = timeout )
143
+ timeout = timeout ,
144
+ threads = threads )
138
145
stop_cmd = None
139
146
else :
140
147
start_cmd = stop_cmd = None
0 commit comments