Skip to content

Commit

Permalink
Revert wrong optimization --autopull
Browse files Browse the repository at this point in the history
  • Loading branch information
iBug committed Jun 15, 2018
1 parent 72b3009 commit 9217ea7
Showing 1 changed file with 9 additions and 22 deletions.
31 changes: 9 additions & 22 deletions findspam.py
Expand Up @@ -340,32 +340,19 @@ def has_health(s, site, *args): # flexible detection of health spam in titles
return False, ""


pattern_keywords = ["Testo?", "Dermapholia", "Garcinia", "Cambogia", "Aurora", "Kamasutra", "HL-?12", "NeuroFuse",
"Junivive", "Apexatropin", "Gain", "Allure", "Nuvella", "Trimgenix", "Satin", "Prodroxatone",
"Elite", "Force", "Exceptional", "Enhance(?:ment)?", "Nitro", "Max", "Boost", "E?xtreme", "Grow",
"Deep", "Male", "Pro", "Advanced", "Monster", "Divine", "Royale", "Angele", "Trinity", "Andro",
"Pure", "Skin", "Sea", "Muscle", "Ascend", "Youth", "Hyper(?:tone)?", "Hydroluxe", "Booster",
"Serum", "Supplement", "Fuel", "Cream", "Keto"]
pattern_keywords_nonmath = pattern_keywords + [r"E?X[tl\d]?", "Alpha", "Plus", "Prime", "Formula"]

pattern_keywords = "|".join(pattern_keywords)
pattern_keywords_nonmath = "|".join(pattern_keywords_nonmath)
pattern_three_words = regex.compile(r"(?i)\b(({0})\W({0})\W({0}))\b".format(pattern_keywords))
pattern_two_words = regex.compile(r"(?i)\b(({0})\W({0}))\b".format(pattern_keywords))
pattern_three_words_nonmath = regex.compile(r"(?i)\b(({0})\W({0})\W({0}))\b".format(pattern_keywords_nonmath))
pattern_two_words_nonmath = regex.compile(r"(?i)\b(({0})\W({0}))\b".format(pattern_keywords_nonmath))


# noinspection PyUnusedLocal,PyMissingTypeHints
def pattern_product_name(s, site, *args):
scanner_three = pattern_three_words
scanner_two = pattern_two_words
keywords = ["Testo?", "Dermapholia", "Garcinia", "Cambogia", "Aurora", "Kamasutra", "HL-?12", "NeuroFuse",
"Junivive", "Apexatropin", "Gain", "Allure", "Nuvella", "Trimgenix", "Satin", "Prodroxatone",
"Elite", "Force", "Exceptional", "Enhance(?:ment)?", "Nitro", "Max", "Boost", "E?xtreme", "Grow",
"Deep", "Male", "Pro", "Advanced", "Monster", "Divine", "Royale", "Angele", "Trinity", "Andro",
"Pure", "Skin", "Sea", "Muscle", "Ascend", "Youth", "Hyper(?:tone)?", "Hydroluxe", "Booster",
"Serum", "Supplement", "Fuel", "Cream", "Keto"]
if site != "math.stackexchange.com" and site != "mathoverflow.net":
scanner_three = pattern_three_words_nonmath
scanner_two = pattern_two_words_nonmath
keywords += [r"E?X[tl\d]?", "Alpha", "Plus", "Prime", "Formula"]

three_words = scanner_three.findall(s)
two_words = scanner_two.findall(s)
three_words = regex.compile(r"(?i)\b(({0})\W({0})\W({0}))\b".format(keywords)).findall(s)
two_words = regex.compile(r"(?i)\b(({0})\W({0}))\b".format(keywords)).findall(s)
if len(three_words) >= 1 and all_matches_unique(three_words):
return True, u"Pattern-matching product name *{}*".format(three_words[0][0])
if len(two_words) >= 2 and all_matches_unique(two_words):
Expand Down

0 comments on commit 9217ea7

Please sign in to comment.