Created
March 9, 2016 05:47
-
-
Save huangziwei/8ebac04139d4ee456268 to your computer and use it in GitHub Desktop.
clean_text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def clean_txt(raw): | |
raw = re.sub('[A-Za-z]+', '', raw) # 去英文 | |
raw = re.sub('\d+(\.)?\d?', '', raw) # 去数字 | |
raw = re.sub('\W+', '', raw) # 去标点 | |
return raw |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment