Skip to content
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

修改了NaiveFilter的两个function,老的不适用了 #9

Open
jacksujingcheng opened this issue Mar 3, 2019 · 0 comments
Open

Comments

@jacksujingcheng
Copy link

Parse function

    def parse(self, path):
        with open(path, 'rb') as f:
            self.keywords = [x.decode('utf8').strip() for x in f.readlines()]

Filter function

    def filter(self, message, repl="*"):
        for kw in self.keywords:
            message = message.replace(kw, len(kw)*repl)
        return message

之前的版本是2.7的我运行不了,我自己根据python3.7改了下NaiveFilter的function。(我也把敏感词那个文件改成txt文件了)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant