'Why am I not getting an output?
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
Solution 1:[1]
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"}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
