Skip to content

Commit

Permalink
Remove upper length limit for "repeating characters" --autopull
Browse files Browse the repository at this point in the history
  • Loading branch information
iBug committed Jul 27, 2018
1 parent 3b553ae commit f02cc81
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions findspam.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ def has_few_characters(s, site, *args):

# noinspection PyUnusedLocal,PyMissingTypeHints
def has_repeating_characters(s, site, *args):
s = regex.sub('http[^"]*', "", s) # remove URLs for this check
if s is None or len(s) == 0 or (len(s) >= 300 and "\n" in s) or regex.compile("<pre>|<code>").search(s):
s = regex.sub('http[^"]*', "", s) # remove URLs for this check
if (not s) or ("\n" in s.strip()) or regex.compile("<pre>|<code>").search(s):
return False, ""
matches = regex.compile(u"([^\\s_\u200b\u200c.,?!=~*/0-9-])(\\1{9,})", regex.UNICODE).findall(s)
match = "".join("".join(match) for match in matches)
Expand Down Expand Up @@ -350,7 +350,7 @@ def pattern_product_name(s, site, *args):
"(?:Anti-)?Ag(?:ed?|ing)", "Trim", "Premi(?:um|er)", "Vital", "Derma?", "Master", "Ultra", "Radiant(?:ly)?",
]
if site != "math.stackexchange.com" and site != "mathoverflow.net":
keywords += ["X[LORT]?", "Alpha", "Plus", "Prime", "Formula"]
keywords += ["X[LOST]?", "Alpha", "Plus", "Prime", "Formula"]
keywords = "|".join(keywords)

three_words = regex.compile(r"(?i)\b(({0})[ -]({0})[ -]({0}))\b".format(keywords)).findall(s)
Expand Down

0 comments on commit f02cc81

Please sign in to comment.