Source code for pm4py.util.regex
[docs]
def get_new_char(label, shared_obj):
"""
Get a new single character describing the activity, for the regex
Parameters
------------
label
Label of the transition
shared_obj
Shared object
"""
list_to_avoid = [
"[",
"]",
"(",
")",
"*",
"+",
"^",
"?",
"\r",
"\n",
" ",
"\t",
"$",
'"',
"!",
"#",
"&",
"%",
"|",
".",
",",
";",
"-",
"'",
"\\",
"/",
"{",
"}",
"$",
]
shared_obj.count_char = shared_obj.count_char + 1
while chr(shared_obj.count_char) in list_to_avoid:
shared_obj.count_char = shared_obj.count_char + 1
shared_obj.mapping_dictio[label] = chr(shared_obj.count_char)
[docs]
class SharedObj:
def __init__(self):
self.mapping_dictio = None
if self.mapping_dictio is None:
self.mapping_dictio = {}
self.count_char = 0