-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fb5cc3
commit d306e7c
Showing
3 changed files
with
19 additions
and
19 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
import re | ||
from pysbd.punctuation_replacer import replace_punctuation | ||
|
||
|
||
class ExclamationWords(object): | ||
""" | ||
Searches for exclamation points that are part of words | ||
and not ending punctuation and replaces them. | ||
""" | ||
EXCLAMATION_WORDS = "!Xũ !Kung ǃʼOǃKung !Xuun !Kung-Ekoka ǃHu ǃKhung ǃKu ǃung ǃXo ǃXû ǃXung ǃXũ !Xun Yahoo! Y!J Yum!".split() | ||
EXCLAMATION_REGEX = r"|".join(re.escape(w) for w in EXCLAMATION_WORDS) | ||
|
||
@classmethod | ||
def apply_rules(cls, text): | ||
return re.sub(ExclamationWords.EXCLAMATION_REGEX, replace_punctuation, | ||
text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters