),
]
- # 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
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'