From cc7ac52a0539f64d7342a57f3660f7b34b1af9df Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 20 Jul 2014 17:38:52 -0400 Subject: [PATCH] Fix query counting. --- earwigbot/wiki/copyvios/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/earwigbot/wiki/copyvios/__init__.py b/earwigbot/wiki/copyvios/__init__.py index 9ed3a67..4b4a2cf 100644 --- a/earwigbot/wiki/copyvios/__init__.py +++ b/earwigbot/wiki/copyvios/__init__.py @@ -286,18 +286,20 @@ class CopyvioMixIn(object): workspace.enqueue(parser.get_links(), exclude) chunks = parser.chunk(self._search_config["nltk_dir"], max_queries) + num_queries = 0 for chunk in chunks: if workspace.best.confidence >= min_confidence: break log = u"[[{0}]] -> querying {1} for {2!r}" self._logger.debug(log.format(self.title, searcher.name, chunk)) workspace.enqueue(searcher.search(chunk), exclude) + num_queries += 1 sleep(1) workspace.wait() result = CopyvioCheckResult( workspace.best.confidence >= min_confidence, - workspace.best.confidence, workspace.best.url, len(chunks), + workspace.best.confidence, workspace.best.url, num_queries, time() - start_time, article, workspace.best.chains) self._logger.info(result.get_log_message(self.title)) return result