12
2
There is currently a meme on the internet that consist of taking a sentence, reverse the meaning and adding n't
at the end. For example, I am small
becomes I am talln't
Challenge
For the sake of the challenge, we'll simplify this : Your task will be to detect whenever there is a negation in a sentence, and replace it with the 'positive' one with n't
added at the end. There will be some tricky parts that will be explained in the rules.
Rules
- You have to take a String as input, and return a String as output.
- Input will be a sentence in lowercase, with only
.
and,
as punctuation marks. - You have to replace any
no <any_word>
ornot <any_word>
with<any_word>n't
. no
/not
have to be a word and not a substring : you don't have to change anything innone of those
- If the word already finish with a
n
, you have to replacen't
with't
:no plan
becomeplan't
and notplann't
- When
no
ornot
isn't followed by any word, a punctuation mark or anotherno
/not
, you have to replace it withyesn't
. - compound words count as one word. so even if
no-op
contain the substringno
, it doesn't contain the word no. So the result will beno-op
and not-opn't
. - You do not have to worry about grammar errors. For example,
there is no way
will result tothere is wayn't
. - No standard loopholes allowed.
- This is codegolf, so the shortest code wins.
There are some examples, even if this challenge looks clearn't for now.
Examples
Input : i love codegolfing, but i do not like short programs. does this sentence makes sense ... of course no.
Output : i love codegolfing, but i do liken't short programs. does this sentence makes sense ... of course yesn't.Input : you are not invited. get out.
Output : you are invitedn't. get out.Input : i am not ok, i have no plan and i have no gunn
Output : i am okn't, i have plan't and i have gunn'tInput : oh no no no i refuse.
Output : oh yesn't yesn't in't refuse.Input : oh no no no, i refuse.
Output : oh yesn't yesn't yesn't, i refuse.Input : i cannot believe this, you can't codegolf.
Output : i cannot believe this, you can't codegolf.Input : oh no ... he did it again.
Output : oh yesn't ... he did it again.Input : nn't is not a word, kevin. so this is not nn't.
Output : nn't is an't word, kevin. so this is nn'tn't.Input : is it not clearn't for everyone
Output : is this clearn'tn't for everyoneInput : this is non't sense ...
Output : this is non't sense ...
1In the introduction, shouldn't
I am small
becomeI am bign't
? – RedClover – 2018-05-30T14:20:59.2874One point says "Input willl be [...] only with only . and ,". Another refers to "no-op". But that contains a "-". So is "-" allowed or not? – recursive – 2018-05-30T15:47:35.367
Should
no n
result innn't
orn't
? – Kevin Cruijssen – 2018-05-31T06:48:23.837no n
sould result inn't
because the 'word'n
finish with an
. – The random guy – 2018-05-31T06:58:35.430@Soaku small, tall, big, tiny, large, long, short etc. are all used interchangeably. It doesn't really matter for the sake of the question. But the most logical antonym for small would be big, yes. – Yates – 2018-05-31T07:48:12.117