Skip to content

added parameter to the NLP directory and joining jar arguments with more standard os.path.join #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions corenlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def __init__(self, corenlp_path=None):
props = "-props default.properties"

# add and check classpaths
jars = [corenlp_path + jar for jar in jars]
jars = [os.path.join(corenlp_path, jar) for jar in jars]
for jar in jars:
if not os.path.exists(jar):
logger.error("Error! Cannot locate %s" % jar)
Expand Down Expand Up @@ -250,11 +250,13 @@ def parse(self, text):
help='Port to serve on (default: 8080)')
parser.add_option('-H', '--host', default='127.0.0.1',
help='Host to serve on (default: 127.0.0.1. Use 0.0.0.0 to make public)')
parser.add_option('-P', '--path', default=None,
help='Path to the dir containing the Stanford parser .jar file')
options, args = parser.parse_args()
server = jsonrpc.Server(jsonrpc.JsonRpc20(),
jsonrpc.TransportTcpIp(addr=(options.host, int(options.port))))

nlp = StanfordCoreNLP()
nlp = StanfordCoreNLP(options.path)
server.register_function(nlp.parse)

logger.info('Serving on http://%s:%s' % (options.host, options.port))
Expand Down