对如何通过节启动 corenlp 客户端感到非常困惑。我无法让它同时在我的 Windows pc 和 ubuntu pc 上工作。环境变量对我来说似乎没问题,因为在“使用命令启动服务器:java [...]”它在两个系统上都获得了正确的路径(如下所示)。
这是来自 Windows 的日志,我使用带有 python 3.7 和 anaconda 的 jupyter notebook。是的,Java 已安装,其版本为 1.8.0_261-b12
2020-08-23 16:19:39 INFO: Writing properties to tmp file: corenlp_server-cb875580c6b14b81.props
2020-08-23 16:19:39 INFO: Starting server with command: java -Xmx4G -cp C:\Users\mikol\stanza_corenlp\* edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 30000 -threads 5 -maxCharLength 100000 -quiet False -serverProperties corenlp_server-cb875580c6b14b81.props -annotators tokenize,ssplit,pos,lemma,ner,parse,depparse,coref -preload -outputFormat serialized
---------------------------------------------------------------------------
UnsupportedOperation Traceback (most recent call last)
<ipython-input-3-8480433fb1e5> in <module>
4 annotators=['tokenize','ssplit','pos','lemma','ner', 'parse', 'depparse','coref'],
5 timeout=30000,
----> 6 memory='4G') as client:
7 ann = client.annotate(test_doc)
8 print(ann)
C:\ProgramData\Anaconda3\lib\site-packages\stanza\server\client.py in __enter__(self)
174
175 def __enter__(self):
--> 176 self.start()
177 return self
178
C:\ProgramData\Anaconda3\lib\site-packages\stanza\server\client.py in start(self)
146 self.server = subprocess.Popen(self.start_cmd,
147 stderr=stderr,
--> 148 stdout=stderr)
149
150 def atexit_kill(self):
C:\ProgramData\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
751 (p2cread, p2cwrite,
752 c2pread, c2pwrite,
--> 753 errread, errwrite) = self._get_handles(stdin, stdout, stderr)
754
755 # We wrap OS handles *before* launching the child, otherwise a
C:\ProgramData\Anaconda3\lib\subprocess.py in _get_handles(self, stdin, stdout, stderr)
1084 else:
1085 # Assuming file-like object
-> 1086 c2pwrite = msvcrt.get_osfhandle(stdout.fileno())
1087 c2pwrite = self._make_inheritable(c2pwrite)
1088
UnsupportedOperation: fileno
两台机器上的错误代码看起来都一样,只是文件路径不同。
如果有人可以帮助我,我将不胜感激,如果没有 corenlp 工具,我在我的项目 atm 上无能为力。