我对情绪分析非常陌生。试图使用斯坦福情感树银行(Sst),并遇到了一个错误。
from nltk.tree import Tree
import os
import sst
trees = "C:\\Users\m\data\trees"
tree, score = next(sst.train_reader(trees))输出
AttributeError Traceback (most recent call last)
<ipython-input-19-4101f90b0b16> in <module>()
----> 1 tree, score = next(sst.train_reader(trees))
AttributeError: module 'sst' has no attribute 'train_reader'发布于 2020-03-03 16:42:48
我想你是在找https://github.com/JonathanRaiman/pytreebank,而不是https://pypi.org/project/sst/。
在python方面,这个错误非常明显。不过,一旦您导入了正确的包,我不确定我是否看到了train_reader,但我可能错了。
更新:我不完全确定为什么您会遇到没有属性train_reader的“sst”。如果您使用conda,请确保您没有意外安装“sst”软件包。看起来,“sst”指的是一个私人创建的模块,其中一个应该可以工作。
我让你的进口工作了,但我做的是:
requirements.txt pip install nltk和pip install nltk这一点,import sst为我工作。发布于 2020-03-03 16:41:34
我想您是在导入sst包selenium--简单测试,这不是您想要的。
尝试sst.discover(),如果您得到了错误
TypeError: discover() missing 4 required positional arguments: 'test_loader', 'package', 'dir_path', and 'names'您正在使用selenium-simple-test包。
https://stackoverflow.com/questions/60511708
复制相似问题