From c4dede145973c954820f9f0ea4f884f9e3d2dd49 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Wed, 20 Aug 2014 03:30:49 -0400 Subject: [PATCH] Reorder length check to potentially fix an empty-query bug. --- earwigbot/wiki/copyvios/parsers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/earwigbot/wiki/copyvios/parsers.py b/earwigbot/wiki/copyvios/parsers.py index de58122..afa93c0 100644 --- a/earwigbot/wiki/copyvios/parsers.py +++ b/earwigbot/wiki/copyvios/parsers.py @@ -99,13 +99,13 @@ class ArticleTextParser(BaseTextParser): sentences = [] for sentence in tokenizer.tokenize(self.clean): - if len(sentence) < min_query: - continue if len(sentence) > max_query: words = sentence.split() while len(" ".join(words)) > max_query: words.pop() sentence = " ".join(words) + if len(sentence) < min_query: + continue sentences.append(sentence) if max_chunks >= len(sentences):