stanfordnlp/python-stanford-corenlp

how to set path and use python-stanford-corenlp while i use mac

prigioni opened this issue · 4 comments

how to use

Hello Prigioni,
Could you be more specific about what the error you are facing? The README documentation provides an example of use: https://github.com/stanfordnlp/python-stanford-corenlp

from stanfordcorenlp import StanfordCoreNLP
nlp = StanfordCoreNLP(r'/Users/lqm/Desktop/stanford-corenlp-full-2018-01-31')

Traceback (most recent call last):
File "/Applications/anaconda3/lib/python3.6/site-packages/psutil/_psosx.py", line 330, in wrapper
return fun(self, *args, **kwargs)
File "/Applications/anaconda3/lib/python3.6/site-packages/psutil/_psosx.py", line 515, in connections
rawlist = cext.proc_connections(self.pid, families, types)
PermissionError: [Errno 1] Operation not permitted

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/lqm/Desktop/python3/test_stanfordcorenlp.py", line 9, in
nlp = StanfordCoreNLP(r'/Users/lqm/Desktop/stanford-corenlp-full-2018-01-31')
File "/Users/lqm/.local/lib/python3.6/site-packages/stanfordcorenlp/corenlp.py", line 79, in init
if port_candidate not in [conn.laddr[1] for conn in psutil.net_connections()]:
File "/Applications/anaconda3/lib/python3.6/site-packages/psutil/init.py", line 2111, in net_connections
return _psplatform.net_connections(kind)
File "/Applications/anaconda3/lib/python3.6/site-packages/psutil/_psosx.py", line 249, in net_connections
cons = Process(pid).connections(kind)
File "/Applications/anaconda3/lib/python3.6/site-packages/psutil/_psosx.py", line 335, in wrapper
raise AccessDenied(self.pid, self._name)
psutil._exceptions.AccessDenied: psutil.AccessDenied (pid=3372)

why?

when I sudo python, it done

You can insert this line
os.environ['CORENLP_HOME'] = "/Users/lqm/Desktop/stanford-corenlp-full-2018-01-31"