def extend_with_similarity(self, rules, specializations):
        '''
        Extends the list based on how similar is 'new_rule'
        to the rules contained in 'rules'.
        '''
        for new_rule in specializations:
            tmp_rules = rules[:]
            for rule in tmp_rules:
                sim = rule.similarity(new_rule)
                if sim >= self.sim and len(rules) > 0.5*self.n:
                    break
            else:
                rules.append(new_rule)
dataset/ETHPy150Open anzev/hedwig/hedwig/learners/learner.py/Learner.extend_with_similarity/original