ai-content-maker/.venv/Lib/site-packages/pysbd/exclamation_words.py

18 lines
628 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- 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 ǃǃ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)