需要删除Python停用词并停用词组吗?删除哪个命令?它们都可以是停用词/短语的一个列表吗?

时间:2019-10-28 23:53:28

标签: python pandas text data-cleaning stop-words

最佳做法是分别用停用词和停用词清除数据吗?我在下面有一个数据框,但需要删除特定的短语和特定的停用词。

import pandas as pd
from nltk.corpus import stopwords
stop = stopwords.words('english')

list_of_phrases_remove = 'I love this asdfasdf car'

stop.append('asdfasdf')

pos_tweets = [('I love this asdfasdf car', 'positive'),
    ('This view is amazing', 'positive'),
    ('I feel great this morning', 'positive'),
    ('I am so excited about the concert', 'positive'),
    ('He is my best friend', 'positive')]

test = pd.DataFrame(pos_tweets)
test.columns = ["tweet","class"]

如果我需要删除停用词“ asdfasdf”又需要从我的list_of_phrases_remove中删除“我爱这辆asdfasdf汽车”怎么办?

从这样的文本的pandas dataframe列中删除停用词以及特定短语的命令流程是什么?

0 个答案:

没有答案
相关问题