I want to separate a list of sentences into two lists based on whether they match the sentiment of a specific keyword. For example:
valid_keyword = "Guest Accepted"
sentences = [
"Guest Allowed", "Max Guest Allowed 1", "Guest Not Allowed",
"No Guest Allowed", "Guest Restricted", "Max Guest Allowed 0",
"Guest Allowed on Request"
]
I want to separate the list in following way:
valid_sentences, which contains sentences that match the sentiment of the valid_keyword (“Guest Accepted”).
invalid_sentences, which contains sentences that do not match the sentiment of the valid_keyword.
The expected output would be:
valid_sentences = ["Guest Allowed", "Max Guest Allowed 1", "Guest Allowed on Request"]
invalid_sentences = ["Guest Not Allowed", "No Guest Allowed", "Guest Restricted", "Max Guest Allowed 0"]
I already tried VaderSentiment, but didn’t get what I expected.
What are the suitable Python libraries that I should go for this process that will give maximum accuracy?
pickachu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.