From 534b3ddda7df1e51e2faf3b1f3680b76dd938b86 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Mon, 27 Feb 2017 12:03:58 +0100 Subject: [PATCH] Optimize sanitation --- markov.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markov.py b/markov.py index c0e0cb0..c08133c 100755 --- a/markov.py +++ b/markov.py @@ -19,7 +19,7 @@ def sanitizeText(text): if text[0] == "@" or text[1] == "@": if split[1][0] not in string.ascii_lowercase: return sanitizeText(" ".join(split[1:])) - if split[-1][0] == "@": + if split[-1][0] == "@" and text[-1] in string.ascii_lowercase: return sanitizeText(" ".join(split[:-1])) if text[:4] == "RT @": return sanitizeText(text.partition(":")[2])