Created
October 12, 2022 17:03
-
-
Save yavuzKomecoglu/2f023d74417f9ecf41e91f20496f0897 to your computer and use it in GitHub Desktop.
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
def preprocess_word(word): | |
# Remove punctuation | |
word = word.strip('\'"?!,.():;``') | |
# Convert more than 2 letter repetitions to 2 letter | |
# funnnnny --> funny | |
word = re.sub(r'(.)\1+', r'\1\1', word) | |
# Remove - & ' | |
word = re.sub(r'(-|\')', '', word) | |
return word |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment