Skip to content
Open
Show file tree
Hide file tree
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 pysbd/cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def search_for_connected_sentences(self, word, txt, regex, rule):
if any(k in word for k in cr.URL_EMAIL_KEYWORDS):
return txt
new_word = Text(word).apply(rule)
txt = re.sub(re.escape(word), new_word, txt)
txt = re.sub(re.escape(word), re.sub(r'[\\]([^abfnrtv\\])', r'\\\\\1', new_word), txt)
return txt

def check_for_no_space_in_between_sentences(self):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def run(self):


setup(
name='pysbd',
name='pysbd-yurts',
version=about['__version__'],
description=about['__summary__'],
long_description=long_description,
Expand Down
15 changes: 15 additions & 0 deletions tests/lang/test_english_clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,21 @@
["Thus increasing the desire for political reform both in Lancashire and in the country at large.[7][8]", "This was a serious misdemeanour,[16] encouraging them to declare the assembly illegal as soon as it was announced on 31 July.[17][18]", "The radicals sought a second opinion on the meeting's legality."]),
("The table in (4) is a sample from the Wall Street Journal (1987).1 According to the distribution all the pairs given in (4) count as candidates for abbreviations.",
[ "The table in (4) is a sample from the Wall Street Journal (1987).1", "According to the distribution all the pairs given in (4) count as candidates for abbreviations."]),
(r"Some text with a path: C:\\This\Is\A\Path. And another sentence.", [r"Some text with a path: C:\\This\Is\A\Path.", "And another sentence."]),
("Shiver me timbers! I've got me eyes on the provided sources, and I'll be answerin' yer question to the best o' me abilities.\n\n* According to Document Title: Z:\\XY\\1999AUX\\1999V1.MN\\V1PRE4.MN, on the 11th of June, a resolution was passed to appoint a committee to prepare and digest the form of a confederation to be entered into between the colonies, and another committee to prepare a plan of treaties to be proposed to foreign powers. (Source: Document Title: Z:\\XY\\1999AUX\\1999V1.MN\\V1PRE4.MN, Information: THE DECLARATION OF INDEPENDENCE—1776 1)\n* No further information is provided in the given sources regarding the specific committee appointed to prepare a plan of treaties to be proposed to foreign powers.\n\nSo, hoist the sails and set course for more information, me hearty! The provided sources don't provide the specific details ye be lookin' for. Ye might need to dig deeper, matey!",
["Shiver me timbers!",
"I've got me eyes on the provided sources, and I'll be answerin' yer question to the best o' me abilities.",
"* According to Document Title: Z:\\XY\\1999AUX\\1999V1.",
"MN\\V1PRE4.",
"MN, on the 11th of June, a resolution was passed to appoint a committee to prepare and digest the form of a confederation to be entered into between the colonies, and another committee to prepare a plan of treaties to be proposed to foreign powers.",
"(Source: Document Title: Z:\\XY\\1999AUX\\1999V1.",
"MN\\V1PRE4.",
"MN, Information: THE DECLARATION OF INDEPENDENCE—1776 1)",
"* No further information is provided in the given sources regarding the specific committee appointed to prepare a plan of treaties to be proposed to foreign powers.",
"So, hoist the sails and set course for more information, me hearty!",
"The provided sources don't provide the specific details ye be lookin' for.",
"Ye might need to dig deeper, matey!"]
),
####################
# add big text test#
####################
Expand Down