-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: 想去掉输出词云中出现的数字和标点符号,有没有方法 #65
Labels
enhancement
New feature or request
Comments
现在似乎还真没有什么好方法…可以暂时在 stopwords 里加上,但没法过滤全。 |
Closed
你好,我最近也在研究词云,这是目前我能想到的解决方案 import re
# 去除 CQ 码
message = re.sub(r"\[CQ:(.+)]", "", message)
# 去除 QQ 表情包
message = re.sub(r"[(.+)]", "", message)
# 去除实数
message = re.sub(r"^(\-|\+)?\d+(\.\d+)?$", "", message)
# 去除标点符号
# message = re.sub(r"\p{P}|\p{S}", "", message) 标点符号我主观认为可能会影响分词效果,所以我注释了那部分,不知道如何处理。 另外,由于在 Python 标准库中的正则模块不支持表达式使用 - import re
+ import regex as re 目前能解决的问题:
|
stopwords是什么,可以设置屏蔽关键词吗,求教! |
是的,设置了 stopwords 的词语不会出现在词云中。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: