Created
April 21, 2019 12:11
genre_text_cleaning
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
# function for text cleaning | |
def clean_text(text): | |
# remove backslash-apostrophe | |
text = re.sub("\'", "", text) | |
# remove everything except alphabets | |
text = re.sub("[^a-zA-Z]"," ",text) | |
# remove whitespaces | |
text = ' '.join(text.split()) | |
# convert text to lowercase | |
text = text.lower() | |
return text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment