Guest User

Untitled

a guest
Apr 26th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. from string import punctuation
  2.  
  3. def remove_punct(text):
  4. text = ' '.join(word.strip(punctuation) for word in text.split() if word.strip(punctuation))
  5. return text
  6. data['Text'] = np.vectorize(remove_punct)(data['Text'])
  7.  
  8. def remove_u(text):
  9. text = text.replace('_','')
  10. return text
  11. data['Text'] = np.vectorize(remove_u)(data['Text'])
Add Comment
Please, Sign In to add comment