For the assignment, we manually use stopwords in order to return sentences without them. However we also have to remove periods, commas, question marks, punctuations and I cant figure out how to do that because if it's attached to the word, it won't remove. here is my code. For example, if I put prep_text('how was the game?') it should print 'how was game'. No question mark or other stopwords. (btw, the stopwords is in the code I just cant figure out how to put it in the code box here lol :
my_stopwords = ['is', 'it', 'the', 'if', '.', 'Is', 'It', 'The', 'If']
def prep_text(sentence):
words = sentence.split(" ")
words_filtered= [word for word in words if not word in my_stopwords]
return (" ").join(words_filtered)