I want to grab phrases that say good or great, but are not negated by the words not or isn't before it.
sents= ["good words", # Words after phrase
"not good words",
"isn't good words",
"great words",
"not great words",
"isn't great words",
"words good", # Words before phrase
"words not good",
"words isn't good"
"words great",
"words not great",
"words isn't great"
"words good words", # Words before and after phrase
"words not good words",
"words isn't good words",
"words great words",
"words not great words",
"words isn't great words",
]
I want to return
good words
words good
words good words
great words
words great
words great words
What is the regular expression that will let me do this? In theory, I want to be able to have a list of words that are only found if the string does not contain any from a list of negatives precede it.