in readability/readability.py [0:0]
def class_weight(self, e):
weight = 0
for feature in [e.get("class", None), e.get("id", None)]:
if feature:
if REGEXES["negativeRe"].search(feature):
weight -= 25
if REGEXES["positiveRe"].search(feature):
weight += 25
if self.positive_keywords and self.positive_keywords.search(feature):
weight += 25
if self.negative_keywords and self.negative_keywords.search(feature):
weight -= 25
if self.positive_keywords and self.positive_keywords.match("tag-" + e.tag):
weight += 25
if self.negative_keywords and self.negative_keywords.match("tag-" + e.tag):
weight -= 25
return weight