From f058cb5e88243f099b90af592fb906fbe32dfbe3 Mon Sep 17 00:00:00 2001 From: Gordon Shumway <39967334+oddluck@users.noreply.github.com> Date: Sun, 22 Dec 2019 12:58:12 -0500 Subject: [PATCH] remove duplicate url strip --- Markovify/plugin.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Markovify/plugin.py b/Markovify/plugin.py index 67f79e0..983b572 100644 --- a/Markovify/plugin.py +++ b/Markovify/plugin.py @@ -298,11 +298,6 @@ class Markovify(callbacks.Plugin): for x in match: text = text.replace(x, '') log.debug("Markovify: %s matches stripPattern for %s. New text text: %s" % (x, channel, text)) - if self.registryValue('stripURL', channel): - new_text = re.sub(r'(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?«»“”‘’]))', '', text) - if new_text != text: - log.debug("Markovify: url(s) stripped from text for %s. New text text: %s" % (channel, new_text)) - text = new_text ends_with_punctuation = False if not text.strip() or text.isspace(): return @@ -359,7 +354,7 @@ class Markovify(callbacks.Plugin): return self.save_corpus(channel) irc.reply("Added {0} comments from r/{1} to corpus for channel {2}.".format(count, subreddit, channel)) - del data, text + del gen, data, text gc.collect() subreddit = wrap(subreddit, [additional('channel'), getopts({'num':'int'}), 'text']) @@ -396,7 +391,7 @@ class Markovify(callbacks.Plugin): self.add_text(channel, text) irc.reply("{0} lines added to brain file for channel {1}.".format(lines, channel)) self.save_corpus(channel) - del data + del data, text gc.collect() text = wrap(text, [additional('channel'), getopts({'process':''}), 'text'])