Skip to content

Commit

Permalink
✏️ typo
Browse files Browse the repository at this point in the history
  • Loading branch information
nipunsadvilkar committed Jul 5, 2020
1 parent 5fb5cc3 commit d306e7c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
17 changes: 0 additions & 17 deletions pysbd/exclaimation_words.py

This file was deleted.

17 changes: 17 additions & 0 deletions pysbd/exclamation_words.py
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)
4 changes: 2 additions & 2 deletions pysbd/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import spacy
from pysbd.utils import Text, TextSpan
from pysbd.lists_item_replacer import ListItemReplacer
from pysbd.exclaimation_words import ExclaimationWords
from pysbd.exclamation_words import ExclamationWords
from pysbd.between_punctuation import BetweenPunctuation
from pysbd.abbreviation_replacer import AbbreviationReplacer

Expand Down Expand Up @@ -162,7 +162,7 @@ def check_for_punctuation(self, txt):
def process_text(self, txt):
if txt[-1] not in self.lang.Punctuations:
txt += 'ȸ'
txt = ExclaimationWords.apply_rules(txt)
txt = ExclamationWords.apply_rules(txt)
txt = self.between_punctuation(txt)
# handle text having only doublepunctuations
if not re.match(self.lang.DoublePunctuationRules.DoublePunctuation, txt):
Expand Down

0 comments on commit d306e7c

Please sign in to comment.