问题描述
我正在尝试使用预处理器库来清除存储在Pandas Data Frame中的文本。我已经安装了最新版本(https://pypi.org/project/tweet-preprocessor/),但收到以下错误消息:
import preprocessor as p
#forming a separate feature for cleaned tweets
for i,v in enumerate(df['text']):
df.loc[v,'text'] = p.clean(i)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-183-94e08e1aff33> in <module>
1 #forming a separate feature for cleaned tweets
2 for i,v in enumerate(df['text']):
----> 3 df.loc[v,'text'] = p.clean(i)
AttributeError: module 'preprocessor' has no attribute 'clean'
解决方法
首先尝试安装-
!pip安装推文预处理器
将预处理器导入为p
还要检查我的github项目以获取更多信息 also check my github project for more information https://github.com/harshmalviya7/nlp-twittertweets-classifier