Why am I not getting an output?

Viewed 40

I'm trying to filter (comments) which is survey response from CSV file so all text. I did

classify[“sentiment”,comments]

And

Counts[classify[“sentiment”,comments]]

Which works fine

So now I want to filter my data to only show negative comments so I'm trying…

Select[comments,classify[“sentiment”,comments]==Negative] 

But I'm not getting any output

1 Answers
comments = {
   "I love this movie",
   "Of cabbages and kings",
   "My phone broke again"};

Select[comments, Classify["Sentiment", #] == "Negative" &]

{"My phone broke again"}

Or calling Classify once on the list of comments, probably faster.

sentiments = Classify["Sentiment", comments];

Extract[comments, Position[sentiments, "Negative"]]

{"My phone broke again"}

Related