Skip to content

Instantly share code, notes, and snippets.

@Navjotbians
Last active May 22, 2021 19:34
Show Gist options
  • Save Navjotbians/09cf80d48626885a3e0d39857a058447 to your computer and use it in GitHub Desktop.
Save Navjotbians/09cf80d48626885a3e0d39857a058447 to your computer and use it in GitHub Desktop.
Clean comment
import re
import string
def clean(input_str):
input_str = input_str.lower()
for sub in SUBSTITUTIONS:
input_str = re.sub(sub[0], sub[1], input_str)
# Eliminate punchuation
input_str = input_str.translate(str.maketrans('','', string.punctuation))
input_str = input_str.strip()
return input_str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment