Skip to content

Commit 973bd62

Browse files
committed
fix: use pre-wrapped candidate patterns after #932 refactor
1 parent 8bf940f commit 973bd62

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

mempalace/palace.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,12 @@ def _candidate_entity_words(text: str) -> list:
147147
from .i18n import get_entity_patterns
148148

149149
patterns = get_entity_patterns(MempalaceConfig().entity_languages)
150+
# candidate_patterns are pre-wrapped with boundary + capture group
151+
# by get_entity_patterns (#932), compile directly without re-wrapping.
150152
rxs = []
151-
for raw_pat in patterns["candidate_patterns"]:
153+
for pat in patterns["candidate_patterns"]:
152154
try:
153-
rxs.append(re.compile(rf"\b({raw_pat})\b"))
155+
rxs.append(re.compile(pat))
154156
except re.error:
155157
continue
156158
_CANDIDATE_RX_CACHE = rxs

0 commit comments

Comments
 (0)