compilled_rules = {}
for scope, rules in scope_rules.items():
    compilled_rules[scope] = {}
for term, rule in rules.items():
    compilled_rules[scope][term] = re.compile(rule)

def test():
    t0 = datetime.datetime.now()
i = 0
time.sleep(1)
while i < 1000000:
    mregex.match_rules(
        'Acabei de ir no posto petrobras. Moro pertinho do posto brasil',
        compilled_rules)
i += 1
t1 = datetime.datetime.now() - t0
print(t1)
print(i / t1.seconds)
cProfile.run('test()', 'testproof')
Каков самый быстрый способ сравнить текст с большим количеством регулярных выражений с python?