Improving speed of matching ~40%
This commit is contained in:
parent
fe4c95939f
commit
44f0a6762e
5
wani.py
5
wani.py
|
@ -468,12 +468,13 @@ def build_morphology_regex(restriction):
|
||||||
if typ:
|
if typ:
|
||||||
min_msd_length = max(index + 1, min_msd_length)
|
min_msd_length = max(index + 1, min_msd_length)
|
||||||
|
|
||||||
|
re_objects = [re.compile(r) for r in rgx]
|
||||||
def matcher(text):
|
def matcher(text):
|
||||||
if len(text) <= min_msd_length:
|
if len(text) <= min_msd_length:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
for c, r in zip(text, rgx):
|
for c, r in zip(text, re_objects):
|
||||||
if not re.match(r, c):
|
if not r.match(c):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user