首页 > 解决方案 > AttributeError:模块“sst”没有属性“train_reader”

问题描述

我对情绪分析很陌生。尝试使用 Stanford Sentiment Treebank(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'

标签: pythonnlpstanford-nlpsentiment-analysissst

解决方案


我猜你正在导入 sst 包 selenium-simple-test,这不是你要找的。

如果出现错误,请尝试 sst.discover()

TypeError: discover() missing 4 required positional arguments: 'test_loader', 'package', 'dir_path', and 'names'

您正在使用 selenium-simple-test 包


推荐阅读