def sort_trigger_set(triggers, exclude_previous=True, say=None):
    if say is None:
        say = lambda x: x
    trigger_object_list = []
    for index, trig in enumerate(triggers):
        if exclude_previous and trig[1]["previous"]:
            continue
        pattern = trig[0]
        match, weight = re.search(RE.weight, trig[0]), 0
        if match:
            weight = int(match.group(1))
        match = re.search(RE.inherit, pattern)
        if match:
            inherit = int(match.group(1))
            say("\t\t\tTrigger belongs to a topic which inherits other topics: level=" + str(inherit))
            triggers[index][0] = pattern = re.sub(RE.inherit, "", pattern)
        else:
            inherit = sys.maxsize
        trigger_object_list.append(TriggerObj(pattern, index, weight, inherit))
    sorted_list = sorted(trigger_object_list,
                         key=attrgetter('weight', 'inherit', 'is_empty', 'star', 'pound',
                                        'under', 'option', 'wordcount', 'len', 'alphabet'))
    return [triggers[item.index] for item in sorted_list]