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"]
related: https://codegolf.stackexchange.com/questions/165753/use-that-goodnt-meme https://codegolf.stackexchange.com/questions/148739/aint-no-thang-or-is-it
– DenDenDo – 2018-09-21T19:23:17.670Shouldn't it be
would
instead ofwill
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 yourWouldn't it be nice
example). – AdmBorkBork – 2018-09-21T19:48:30.2831Are we really supposed (or at least allowed) to replace
won't
withwo
as one of the examples suggest? If the rule is just removen't
, then this is inconsistent withcan't
: according to the table, it must be replaced withcan
rather thanca
. – Arnauld – 2018-09-22T08:37:18.8932I'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
andwon't
from the requirements and tests and allow undefined behaviour in those cases instead of overcomplicating it – DenDenDo – 2018-09-22T14:32:58.010In
We don't need no education
, wouldWe need no education
/We do need no education
also be valid? – Artemis still doesn't trust SE – 2018-09-23T13:55:21.123