From 98cdfa6419e35c4e3d0ddc4b623e1c39cc49da0f Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 11 Oct 2018 12:55:19 +0100 Subject: [PATCH] Strip common characters that mark the end of a word (":;,!?~") from the end of words in modules/words.py --- modules/words.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/words.py b/modules/words.py index 160325ff..e5e1ff16 100644 --- a/modules/words.py +++ b/modules/words.py @@ -1,6 +1,8 @@ import time from src import EventManager, ModuleManager, utils +WORD_STOP = ";:,!?~" + class Module(ModuleManager.BaseModule): def _channel_message(self, user, event): words = list(filter(None, event["message_split"])) @@ -18,6 +20,7 @@ class Module(ModuleManager.BaseModule): tracked_words = set(event["server"].get_setting( "tracked-words", [])) for word in words: + word = word.rstrip(WORD_STOP) if word.lower() in tracked_words: setting = "word-%s" % word word_count = user.get_setting(setting, 0)