Browse Source

Reorder length check to potentially fix an empty-query bug.

tags/v0.2
Ben Kurtovic 10 years ago
parent
commit
c4dede1459
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      earwigbot/wiki/copyvios/parsers.py

+ 2
- 2
earwigbot/wiki/copyvios/parsers.py View File

@@ -99,13 +99,13 @@ class ArticleTextParser(BaseTextParser):


sentences = [] sentences = []
for sentence in tokenizer.tokenize(self.clean): for sentence in tokenizer.tokenize(self.clean):
if len(sentence) < min_query:
continue
if len(sentence) > max_query: if len(sentence) > max_query:
words = sentence.split() words = sentence.split()
while len(" ".join(words)) > max_query: while len(" ".join(words)) > max_query:
words.pop() words.pop()
sentence = " ".join(words) sentence = " ".join(words)
if len(sentence) < min_query:
continue
sentences.append(sentence) sentences.append(sentence)


if max_chunks >= len(sentences): if max_chunks >= len(sentences):


Loading…
Cancel
Save