summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2022-02-03 11:53:51 -0800
committerScott Gasch <[email protected]>2022-02-03 11:53:51 -0800
commitffed473528c4feb836253758e86f7839af98f57b (patch)
tree91f9f0584addc34ccf8edd5d8a07868628b42046
parent6fbb17430258cb94e3dbba6b4e45e5ea3d8098c7 (diff)
Disallow where're too.
-rw-r--r--string_utils.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/string_utils.py b/string_utils.py
index 1ed9b4a..bae5906 100644
--- a/string_utils.py
+++ b/string_utils.py
@@ -1366,7 +1366,7 @@ def make_contractions(txt: str) -> str:
),
]
- # Special cases
+ # Special cases: can't, shan't and won't.
txt = re.sub(r'\b(can)\s*no(t)\b', r"\1'\2", txt, count=0, flags=re.IGNORECASE)
txt = re.sub(
r'\b(sha)ll\s*(n)o(t)\b', r"\1\2'\3", txt, count=0, flags=re.IGNORECASE
@@ -1378,8 +1378,9 @@ def make_contractions(txt: str) -> str:
for first_list, second_list in first_second:
for first in first_list:
for second in second_list:
- # Disallow there're. It's valid English but sounds weird.
- if first == 'there' and second == 'a(re)':
+ # Disallow there're/where're. They're valid English
+ # but sound weird.
+ if (first == 'there' or first == 'where') and second == 'a(re)':
continue
pattern = fr'\b({first})\s+{second}\b'