10000 made path to CoreNLP jars a variable to be easily edited · ez-max/stanford-corenlp-python@c7d3d53 · GitHub
[go: up one dir, main page]

Skip to content

Commit c7d3d53

Browse files
committed
made path to CoreNLP jars a variable to be easily edited
1 parent 2ef4e40 commit c7d3d53

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

corenlp.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,25 @@ def __init__(self):
100100
"jgraph.jar",
101101
"jgrapht.jar",
102102
"xom.jar"]
103-
103+
104+
# if CoreNLP libraries are in a different directory,
105+
# change the corenlp_path variable to point to them
106+
corenlp_path = ""
107+
java_path = "java"
104108
classname = "edu.stanford.nlp.pipeline.StanfordCoreNLP"
105-
javapath = "java"
106109
# include the properties file, so you can change defaults
107110
# but any changes in output format will break parse_parser_results()
108111
props = "-props default.properties"
109112

113+
# add and check classpaths
114+
jars = [corenlp_path + jar for jar in jars]
110115
for jar in jars:
111116
if not os.path.exists(jar):
112117
print "Error! Cannot locate %s" % jar
113118
sys.exit(1)
114119

115120
# spawn the server
116-
self._server = pexpect.spawn("%s -Xmx3g -cp %s %s %s" % (javapath, ':'.join(jars), classname, props))
121+
self._server = pexpect.spawn("%s -Xmx3g -cp %s %s %s" % (java_path, ':'.join(jars), classname, props))
117122

118123
print "Starting the Stanford Core NLP parser."
119124
self.state = "plays hard to get, smiles from time to time"

0 commit comments

Comments
 (0)
0