Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created December 20, 2020 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/1ed5b2f2b0285cbd14f2b31a9263b1c0 to your computer and use it in GitHub Desktop.
Save amankharwal/1ed5b2f2b0285cbd14f2b31a9263b1c0 to your computer and use it in GitHub Desktop.
def clean_text(txt):
txt = "".join(v for v in txt if v not in string.punctuation).lower()
txt = txt.encode("utf8").decode("ascii",'ignore')
return txt
corpus = [clean_text(x) for x in all_headlines]
corpus[:10]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment