(yes, that title was intentional)
Your task is to correct common grammatical mistakes.
- Capitalise the first letter of each sentence, ie the first non-whitespace letter after any of
.!?and, additionally, capitalise the first letter of the input
- Remove repeating punctuation, such as
!!! -> !. Ellipses (
...) are not special, and will collapse into
- Remove repeating whitespace
<space><space><space> -> <space>
- Remove whitespace directly before any of
Hello , World ! -> Hello, World!
- If there is no space directly after any of
.,;!?, add it.
- Add a
.at the end of the input if there is not any of
.!?at the end.
Not use Mathematica's builtins
This is a sentence .Unfortunately, it's not very grammatically correct.can you fix it ??? This is a sentence. Unfortunately, it's not very grammatically correct. Can you fix it? buffalo, buffalo;buffalo buffalo? Buffalo.buffalo Buffalo buffalo Buffalo, buffalo; buffalo buffalo? Buffalo. Buffalo Buffalo buffalo. i'm not sure what to put for this test case... I'm not sure what to put for this test case. !this is a test. .Can ...you . . . 'ear me Ground-Control? ?! 'ere as in what you do with you're [sic] ears ! ! This is a test. Can. You. 'ear me Ground-Control?! 'ere as in what you do with you're [sic] ears!