Skip to content

Instantly share code, notes, and snippets.

@gsscoder
Created November 23, 2019 07:42
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 gsscoder/05e2b1e635acfc47a075999f75738e10 to your computer and use it in GitHub Desktop.
Save gsscoder/05e2b1e635acfc47a075999f75738e10 to your computer and use it in GitHub Desktop.
Python function to split into words ignoring punctuation
import re
def wordify(text):
words = []
matches = re.findall(r'(\b[^\s]+\b)', text)
if matches:
for word in matches:
words.append(word)
return words
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment