Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Function for pre-processing keywords
def preprocess_keys(text):
# Case Normalization
text=text.lower()
# Removing hyphen and whitespaces
text=re.sub('(\s|-)+',' ',text)
# Removing any leading and trailing spaces
text=text.strip()
return text
# Pre-processing Keywords
for i in keys:
keys[i]=[preprocess_keys(key) for key in keys[i]]
# Printing some sample keywords
dict(list(keys.items())[:4])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment