Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,10 +19,8 @@ def apply_name_tags(text: str, names: list, start_index: int = 100) -> tuple[str
|
|
| 19 |
|
| 20 |
for name in names:
|
| 21 |
tag = f"{TAG_PREFIX}{counter:03d}"
|
| 22 |
-
pattern = re.compile(
|
| 23 |
-
|
| 24 |
-
re.IGNORECASE
|
| 25 |
-
)
|
| 26 |
tagged_text, n = pattern.subn(tag, tagged_text)
|
| 27 |
if n > 0:
|
| 28 |
mapping[tag] = name
|
|
|
|
| 19 |
|
| 20 |
for name in names:
|
| 21 |
tag = f"{TAG_PREFIX}{counter:03d}"
|
| 22 |
+
pattern = re.compile(rf"([\s\(\[\"']*){re.escape(kw)}([가-힣\s.,;:!?()\[\]\"']*)", re.IGNORECASE)
|
| 23 |
+
|
|
|
|
|
|
|
| 24 |
tagged_text, n = pattern.subn(tag, tagged_text)
|
| 25 |
if n > 0:
|
| 26 |
mapping[tag] = name
|