Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

function to remove stop words in python

import nltk
from nltk.corpus import stopwords
nltk.download('stopwords')

def remove_stopwords(text):
    '''a function for removing the stopword'''
    # removing the stop words and lowercasing the selected words
    text = [word.lower() for word in text.split() if word.lower() not in stopwords.words("english")]
    # joining the list of words with space separator
    return " ".join(text)
 
PREVIOUS NEXT
Tagged: #function #remove #stop #words #python
ADD COMMENT
Topic
Name
6+5 =