我想通过下面的代码使用斯坦福POS恶搞在NLTK为“不是有效的Win32应用程序”:运行在NLTK斯坦福POS恶搞导致在Windows
import nltk
from nltk.tag.stanford import POSTagger
st = POSTagger('E:\Assistant\models\english-bidirectional-distsim.tagger',
'E:\Assistant\stanford-postagger.jar')
st.tag('What is the airspeed of an unladen swallow?'.split())
这里是输出:
Traceback (most recent call last):
File "E:\J2EE\eclipse\WSNLP\nlp\src\tagger.py", line 5, in <module>
st.tag('What is the airspeed of an unladen swallow?'.split())
File "C:\Python34\lib\site-packages\nltk\tag\stanford.py", line 59, in tag
return self.tag_sents([tokens])[0]
File "C:\Python34\lib\site-packages\nltk\tag\stanford.py", line 81, in tag_sents
stdout=PIPE, stderr=PIPE)
File "C:\Python34\lib\site-packages\nltk\internals.py", line 153, in java
p = subprocess.Popen(cmd, stdin=stdin, stdout=stdout, stderr=stderr)
File "C:\Python34\lib\subprocess.py", line 858, in __init__
restore_signals, start_new_session)
File "C:\Python34\lib\subprocess.py", line 1111, in _execute_child
startupinfo)
OSError: [WinError 193] %1 is not a valid Win32 application
PS我的java主页已设置,我没有问题,我的Java安装。有人可以解释这个错误在说什么吗?这对我没有帮助。提前致谢。
你可以从命令行运行Java吗?如果没有,请先解决。 – tripleee 2014-10-30 07:45:33
我可以在命令行中运行java。即使我添加了stanford jar的环境变量到我的java家中。还有其他的可能吗? – Mohammadreza 2014-10-31 04:17:17
关于这个问题的任何想法? – Mohammadreza 2014-11-01 03:48:52