def evaluate(self, tag): score = self.start_score for child in tag.children: score += core.get_total_score(child) return self.process(score)
def select(self, tag): if isinstance(tag, element.Tag): for child in reversed(tag.find_all()): if not isinstance(tag, element.Tag): continue score = core.get_total_score(child) if self.mode == "upper": if score < self.threshold: self.actor.act(child) else: if score > self.threshold: self.actor.act(child)