I won't not use no double negatives

2

The goal is to simplify sentences containing multiple negatives.
Like with multiplying negative numbers, two negative words annihilate each other until at most one is left (doesn't matter which one). While some words disappear without a trace, other leave behind a positive part

The affected words are:

no
not
couldn't    could
wouldn't    would
shouldn't   should
don't       do
doesn't     does
didn't      did
isn't       is
aren't      are
weren't     were

You will notice that I conveniently forgot to include some rules like shan't/shall, won't/will, nothing/something, impossible/possible. Hunting down all the exceptions is a nightmare and would make it yet another string compression challenge.
But if including some additional rules that are not listed, yet are in the spirit of the challenge would make your code shorter (looking at you, Mathematica built-ins), by all means, go for it.

Examples

Input

Move along
Nothing to see here
This sentence will stay the same
You dont put Nosferatu's donut knot in the cantaloupe cannon without an apostrophe.

Don't change this sentence.
This one will also not change
So far no inputs were changed

We don't need no education!
No, don't say that!
Wouldn't it be nice if people weren't fighting?

I don't not use no double negatives.
This isn't not the usual way to not express yourself not 
We don't not have no time to not don't solve this
I don't not even know if this isn't not making no sense anymore, it wouldn't be so bad if it weren't for not all these not words which not shouldn't be not there in the first place

Output (either of the elements is valid)

["Move along"]
["Nothing to see here"]
["This sentence will stay the same"]
["You dont put Nosferatu's donut knot in the cantaloupe cannon without an apostrophe."]

["Don't change this sentence."]
["This one will also not change"]
["So far no inputs were changed"]

["We do need education!"]
[", do say that!", "do say that!", "Do say that!"]
["Would it be nice if people were fighting?"]

["I don't use double negatives.", "I do not use double negatives.", "I do use no double negatives."]
["This is the usual way to express yourself"]
["We don't have time to do solve this", "We do not have time to do solve this", "We do have no time to do solve this", "We do have time to not do solve this", "We do have time to don't solve this"]
["I do even know if this is making sense anymore, it would be so bad if it were for all these words which should be there in the first place"]

DenDenDo

Posted 2018-09-21T19:21:32.270

Reputation: 2 811

Question was closed 2018-09-22T14:23:53.340

Shouldn't it be would instead of will in your example? – Don Thousand – 2018-09-21T19:35:53.070

@RushabhMehta sorry i dont see which will you mean, would you suggest an edt, then i can reject or approve it – DenDenDo – 2018-09-21T19:43:33.343

1I'm confused as to when to remove the whole word (as in your We don't need no education example) or when to replace the word with its complement (as in your Wouldn't it be nice example). – AdmBorkBork – 2018-09-21T19:48:30.283

1Are we really supposed (or at least allowed) to replace won't with wo as one of the examples suggest? If the rule is just remove n't, then this is inconsistent with can't: according to the table, it must be replaced with can rather than ca. – Arnauld – 2018-09-22T08:37:18.893

2I'm temporarily voting to close as unclear. Please ping me when it's clarified so that I can retract my vote or vote to reopen. – Arnauld – 2018-09-22T08:38:45.250

1I removed can't and won't from the requirements and tests and allow undefined behaviour in those cases instead of overcomplicating it – DenDenDo – 2018-09-22T14:32:58.010

In We don't need no education, would We need no education/We do need no education also be valid? – Artemis still doesn't trust SE – 2018-09-23T13:55:21.123

Answers

0

Retina 0.8.2, 44 bytes

i`(\bnot?\W+|n't\b)(.*?)(\bnot?\W+|n't\b)
$2

Try it online! Link includes test cases.

Neil

Posted 2018-09-21T19:21:32.270

Reputation: 95 035

It is apparently allowed to replace won't with wo (!), but the table suggests that can't should be replaced with can rather than ca. (I think this needs to be clarified in the challenge, anyway.) – Arnauld – 2018-09-22T08:09:03.407

@Arnauld Like this?

– Neil – 2018-09-22T10:43:32.770

Yes, but let's see how this is clarified by the OP.

– Arnauld – 2018-09-22T10:46:33.400