Created
August 4, 2020 03:30
-
-
Save abhishek-shrm/f6d694dbc11c8d7f2a3349560fb4cac4 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
# Lowercasing the text | |
training_queries['cleaned']=training_queries['query'].apply(lambda x:x.lower()) | |
testing_queries['cleaned']=testing_queries['query'].apply(lambda x:x.lower()) | |
# Expanding contractions | |
training_queries['cleaned']=training_queries['cleaned'].apply(lambda x:expand_contractions(x)) | |
testing_queries['cleaned']=testing_queries['cleaned'].apply(lambda x:expand_contractions(x)) | |
# Cleaning queries using RegEx | |
training_queries['cleaned']=training_queries['cleaned'].apply(lambda x: clean_text(x)) | |
testing_queries['cleaned']=testing_queries['cleaned'].apply(lambda x: clean_text(x)) | |
# Removing extra spaces | |
training_queries['cleaned']=training_queries['cleaned'].apply(lambda x: re.sub(' +',' ',x)) | |
testing_queries['cleaned']=testing_queries['cleaned'].apply(lambda x: re.sub(' +',' ',x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment