Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion h2p_parser/h2p.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def replace_first(target, replacement, text):
if target is None or target == '':
return text
# Replace the first instance of a word with its phonemes
return re.sub(r'(?i)\b' + target + r'\b', replacement, text, 1)
return re.sub(r'(?i)\b' + re.escape(target) + r'\b', replacement, text, 1)


class H2p:
Expand Down