Skip to content

Instantly share code, notes, and snippets.

@agustinustheo
Created February 22, 2019 12:46
Show Gist options
  • Select an option

  • Save agustinustheo/8fb5aa01632dfd350dcd70d22d84110a to your computer and use it in GitHub Desktop.

Select an option

Save agustinustheo/8fb5aa01632dfd350dcd70d22d84110a to your computer and use it in GitHub Desktop.
Remove Unnecessary Noise function for Filtering Fake News Blog
def remove_unnecessary_noise(text_messages):
text_messages = re.sub(r'\\([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9])\\([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9])\\([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9])', ' ', text_messages)
text_messages = re.sub(r'\\([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9])\\([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9])([a-z]|[A-Z]|[0-9])', ' ', text_messages)
text_messages = re.sub(r'\[[0-9]+\]|\[[a-z]+\]|\[[A-Z]+\]|\\\\|\\r|\\t|\\n|\\', ' ', text_messages)
return text_messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment