I need to use regex to strip punctuation at the start and end of a word. It seems like regex would be the best option for this. I don\'t want punctuation r
I think this function will be helpful and concise in removing punctuation:
import re
def remove_punct(text):
new_words = []
for word in text:
w = re.sub(r'[^\w\s]','',word) #remove everything except words and space#how
#to remove underscore as well
w = re.sub(r'\_','',w)
new_words.append(w)
return new_words