Debugging the Ransom module

Code works properly on test files, but doesn't print anything in AIL...
pull/53/head
Alainfou 2016-03-24 10:11:54 -04:00
parent beb124f0bd
commit ff35940278
1 changed files with 8 additions and 3 deletions

View File

@ -45,13 +45,18 @@ def search_ransom(message):
# Check the content of the Paste: # Check the content of the Paste:
for word in content.split(): for word in content.split():
word = word.lower() word = word.lower()
#if the word has been found already, ignore the repetition
# If the word has been found already:
# either add only 1 to the counter (minimize the effects of repetitions)
# or ignore the repetition
if word in threat_words: if word in threat_words:
# counter+=1
continue continue
# if a keyword is found to match our dictionary, we add its weight to the total counter # if a keyword is found to match our dictionary, we add its weight to the total counter
if word in dict_ransom: if word in dict_ransom:
counter += dict_ransom[word] counter += dict_ransom[word]
#add the word to the list of found threatening words, in order to ignore later repetitions # add the word to the list of found threatening words, to ignore later repetitions
threat_words.append(word) threat_words.append(word)
# if the sum of threat indices is greater than 42 (totally random number), # if the sum of threat indices is greater than 42 (totally random number),