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