Answers for "remove stopwords from a string python"

0

remove stopwords from list of strings python

from nltk.corpus import stopwords
stopwords=set(stopwords.words('english'))

data =['I really love writing journals','The mat is very comfortable and I will buy it again likes','The mousepad is smooth']

def remove_stopwords(data):
    output_array=[]
    for sentence in data:
        temp_list=[]
        for word in sentence.split():
            if word.lower() not in stopwords:
                temp_list.append(word)
        output_array.append(' '.join(temp_list))
    return output_array





output=remove_stopwords(data)

print(output)
['really love writing journals','mat comfortable buy likes', 'mousepad smooth']
Posted by: Guest on September-03-2021
0

for loop get rid of stop words python

list(filter(lambda word: word not in stop_words, df.cleaned[0]))
Posted by: Guest on November-25-2020

Code answers related to "remove stopwords from a string python"

Python Answers by Framework

Browse Popular Code Answers by Language