Skip to content

Commit e4126f5

Browse files
committed
Generalized jar loading
1 parent 84eed35 commit e4126f5

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

corenlp/corenlp.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from progressbar import ProgressBar, Fraction
3232
from unidecode import unidecode
3333
from subprocess import call
34+
import glob
3435

3536
use_winpexpect = True
3637

@@ -99,14 +100,8 @@ def init_corenlp_command(corenlp_path, memory, properties):
99100
"""
100101

101102
# TODO: Can edit jar constants
102-
jars = ["stanford-corenlp-3.2.0.jar",
103-
"stanford-corenlp-3.2.0-models.jar",
104-
"xom.jar",
105-
"joda-time.jar",
106-
"jollyday.jar"
107-
]
108-
109-
jars = ["*"]
103+
jar_mask = ["*.jar"]
104+
jars = glob.glob(os.path.join(corenlp_path, jar))
110105

111106
java_path = "java"
112107
classname = "edu.stanford.nlp.pipeline.StanfordCoreNLP"
@@ -120,12 +115,6 @@ def init_corenlp_command(corenlp_path, memory, properties):
120115
else:
121116
raise Exception("Error! Cannot locate: %s" % properties)
122117

123-
# add and check classpaths
124-
jars = [os.path.join(corenlp_path,jar) for jar in jars]
125-
for jar in jars:
126-
if not os.path.exists(jar) and not "*" in jar:
127-
raise Exception("Error! Cannot locate: %s" % jar)
128-
129118
# add memory limit on JVM
130119
if memory:
131120
limit = "-Xmx%s" % memory

0 commit comments

Comments
 (0)