Introduction
Street talk can be really difficult to understand, in particular to programmers, who aren't known to be very streetwise.
It is your job to create an interpreter to help us all survive in the urban environment.
Challenge
Given an English sentence as input, create a program or a function that determines whether the outcome of the sentence is positive or negative.
The sentence will contain 0
to 2
negative words. As any programmer knows, a double negative results in a positive. Therefore, your code must output or return a truthy/falsey value according to the following rule:
No negative words -> truthy
One negative word -> falsey
Two negative words -> truthy
The list of negative words:
no
,not
,none
- Anything ending in
n't
never
,neither
,nor
nobody
,nothing
,nowhere
There is one edge case. Whenever a sentence begins with No,
, that word isn't treated as a negative word when determining the result (it does count towards the number of negative words so there can be just one more).
The sentence will follow basic grammar rules (capitalization, punctuation) and will only contain words that can be found from a dictionary (luckily, this doesn't invalidate the question title). The sentence won't contain any proper nouns (sorry, Dr. No, you're out).
Test cases
Truthy:
Yes.
It's noon.
Hello, World!
What is this?
Ain't no thang!
Never say never.
No, it's noon now.
Neither me nor you.
I didn't do nothing!
No, I am your father.
A non-alcoholic drink.
I can't get no satisfaction.
All your base are belong to us.
Falsey:
No.
No, no!
Not today.
Neither am I.
Don't do that!
That's no moon!
And none survived.
Is this not my car?
No man is an island.
Nosebleeds are no fun.
Nothing compares to you.
That's a no, I'm afraid.
No, I am not your mother.
The irony here, of course, is that some of these should be interpreted differently. But hey, you can't fault the speaker for not conforming to our logic.
Rules
Standard loopholes are forbidden. This is code-golf, so be concise!
been
for a 100% negative sentence! \$\endgroup\$