nosdigitalmedia's picture
Attempt to set up application
4e0f321
raw
history blame contribute delete
518 Bytes
class RuleBasedSystem:
rules = []
def __init__(self, rules: list):
self.rules = rules
def allows(self, comment_text: str) -> (bool, list):
allows, reasons, highlights = True, [], []
for rule in self.rules:
verdict = rule.get_verdict(comment_text)
if not verdict.allowed:
allows = False
reasons.append(rule.get_rule_description())
highlights += verdict.highlights
return allows, reasons, highlights