使用re.sub

时间:2018-12-22 19:51:18

标签: python regex tweepy

我有以下表达式来删除停用词,其他字符,降低它们等等:

stopword_set = set(stopwords.words("english"))
return " ".join([i for i in re.sub(r'[^a-zA-Z\s]', "", raw_text).lower().split() if i not in stopword_set])

现在,我想添加一些内容:

re.sub(r'[^a-zA-Z\s]', "", raw_text)

删除网址并将其替换为空格键。 我尝试了几种类似的方法:(但不起作用)

re.sub(r'[^a-zA-Z\s]["http\S+"]', "", raw_text)

如何添加表达式?

0 个答案:

没有答案