2025-09-30 13:33:12 +02:00
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def special_regex_maker(special_tokens: list[str]) -> re.Pattern:
|
2025-10-03 10:38:35 +02:00
|
|
|
""" compile a regex for the special token
|
|
|
|
|
Args:
|
|
|
|
|
special_tokens (list[str]): the list of special token
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
re.Pattern:
|
|
|
|
|
"""
|
2025-09-30 13:33:12 +02:00
|
|
|
|
|
|
|
|
REGEX_STR = "|".join(special_tokens)
|
|
|
|
|
|
|
|
|
|
return re.compile(REGEX_STR)
|
|
|
|
|
|