Upload text_utils.py with huggingface_hub
Browse files- text_utils.py +5 -0
text_utils.py
CHANGED
@@ -124,3 +124,8 @@ def nested_tuple_to_string(nested_tuple: tuple) -> str:
|
|
124 |
else:
|
125 |
result.append(str(item))
|
126 |
return "_".join(result)
|
|
|
|
|
|
|
|
|
|
|
|
124 |
else:
|
125 |
result.append(str(item))
|
126 |
return "_".join(result)
|
127 |
+
|
128 |
+
|
129 |
+
def is_made_of_sub_strings(string, sub_strings):
|
130 |
+
pattern = "^(" + "|".join(map(re.escape, sub_strings)) + ")+$"
|
131 |
+
return bool(re.match(pattern, string))
|