Created
November 23, 2019 07:42
-
-
Save gsscoder/05e2b1e635acfc47a075999f75738e10 to your computer and use it in GitHub Desktop.
Python function to split into words ignoring punctuation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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