Skip to content

Instantly share code, notes, and snippets.

@BinarySpoon
Created December 2, 2020 05:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BinarySpoon/283fd7dc1fdf32c60c843df115e186a2 to your computer and use it in GitHub Desktop.
Save BinarySpoon/283fd7dc1fdf32c60c843df115e186a2 to your computer and use it in GitHub Desktop.
def process_message(message):
# Remove punctuations -->
nopunc = [x for x in message if x not in string.punctuation]
nopunc = ''.join(nopunc)
#Remove stop words -->
clean_message = [x for x in nopunc.split() if x.lower() not in stopwords.words('english')]
return clean_message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment