Python中文
首页
教程
问答
标签
搜索
登录
注册
斯坦福依赖分析器设置和NLTK
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>因此,感谢danger89对上一篇文章<a href="https://stackoverflow.com/questions/13883277/stanford-parser-and-nltk">Stanford Parser and NLTK</a>的回答,我得到了“标准”斯坦福解析器。</p> <p>但是,我现在正试图让依赖关系解析器工作,并且在前面的链接中突出显示的方法似乎不再工作。这是我的代码:</p> <pre><code>import nltk import os java_path = "C:\\Program Files\\Java\\jre1.8.0_51\\bin\\java.exe" os.environ['JAVAHOME'] = java_path from nltk.parse import stanford os.environ['STANFORD_PARSER'] = 'path/jar' os.environ['STANFORD_MODELS'] = 'path/jar' parser = stanford.StanfordDependencyParser(model_path="path/jar/englishPCFG.ser.gz") sentences = parser.raw_parse_sents(nltk.sent_tokenize("The iPod is expensive but pretty.")) </code></pre> <p>我得到以下错误:<strong><em>“module”对象没有属性“StanfordDependencyParser”</em></strong></p> <p>我唯一改变的是“StanfordDependencyParser”中的“StanfordParser”。有什么办法可以让它工作吗?</p> <p>我还尝试了Stanford神经依赖性解析器,如这里的文档所示导入它:<a href="http://www.nltk.org/_modules/nltk/parse/stanford.html" rel="nofollow noreferrer">http://www.nltk.org/_modules/nltk/parse/stanford.html</a></p> <p>这个也没用。</p> <p>对NLTK来说很陌生。提前感谢您的帮助。</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>如果您只更改了'StanfordDependencyParser'和错误状态:<code>module' object has no attribute 'StanfordDependencyParser'</code>,我会假设<code>StanfordDependencyParser</code>是错误的更改。你把所有链接到的代码都一字不差地复制了吗?</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
VirtualEnvRapper错误:路径python2(来自python=python2)不存在
6 回答
virtualenvs上的pyinstaller,没有名为导入错误的模块
1 回答
virtualenvs是否可以退回到用户包而不是系统包?
8 回答
virtualenvwrapper CentOS7
3 回答
virtualenvwrapper IOError:[Errno 13]权限被拒绝
6 回答
virtualenvwrapper mkproject和shell在windows中的启动问题?
10 回答
virtualenvwrapper mkvirtualenv不工作但没有错误
1 回答
Virtualenvwrapper python bash
6 回答
virtualenvwrapper:“workon”何时更改到项目目录?
5 回答
virtualenvwrapper:mkvirtualenv可以工作,但是rmvirtualenv返回bash:没有这样的文件或目录
10 回答
virtualenvwrapper:virtualenv信息存储在哪里?
5 回答
virtualenvwrapper:命令“python设置.pyegg_info“失败,错误代码为1
3 回答
virtualenvwrapper:如何将mkvirtualenv的默认Python版本/路径更改为ins
3 回答
Virtualenvwrapper:模块“pkg_resources”没有属性“iter_entry_points”
2 回答
Virtualenvwrapper:没有名为virtualenvwrapp的模块
5 回答
Virtualenvwrapper.bash_profi的正确设置
10 回答
Virtualenvwrapper.hook:权限被拒绝
8 回答
virtualenvwrapper.sh:fork:资源暂时不可用Python/Djang
3 回答
Virtualenvwrapper.shlssitepackages命令不工作
10 回答
Virtualenvwrapper.sh函数在bash sh中不可用
10 回答