Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am running a Sentiment Analysis API in Qlikview. However I get only two sentiment score 0 and 0.25. One for the top header field and other for the first post. My text field has 4 rows in the table Timeine. Why am I not getting the missing ones ? Below is my script. Before this script, I have my data loaded from the table Timeline
LET noRows = NoOfRows('Timeline');
for i=0 to $(noRows)-1
let text = peek('text', $(i), 'Timeline');
Sentiment:
LOAD
'$(text)' as text,
status as sentiment_status,
score as sentiment_score
FROM
(qvx);
next
pankajchopra wrote:
My other question is do you know how can I modify this script to generate another column saying that text is positive if the sentiment score is between lets say >0 and negative if its <0
modify the existing code section like:
Sentiment:
LOAD
'$(text)' as text,
status as sentiment_status,
score as sentiment_score,
If (score<0, 'Negative' , 'Positive' ) as Score_flag
FROM ..
Have you checked if the field text (table - Sentiment) is getting populated with all the four values as in table - 'Timeline' ? If the answer is yes, then I would request you to see if there is really other values in your source
FROM
(qvx);
Because your data load would be done on variant
FROM
'......Message=$(text)]
(qvx);
Hi tres
Thank you for your reply.
So I found that QV is giving me the right results actually. It just doesnt gives a value for every posts instead it will ige only one value in my case 0 for all texts which had a neutral sentiment and the other value for one text which had a positive sentiment. So in my case 3 of the rows of text had a 0 value because when I click on them they all point to 0 sentiment score. I guess this is because of the associative technology of QV.
My other question is do you know how can I modify this script to generate another column saying that text is positive if the sentiment score is between lets say >0 and negative if its <0
pankajchopra wrote:
My other question is do you know how can I modify this script to generate another column saying that text is positive if the sentiment score is between lets say >0 and negative if its <0
modify the existing code section like:
Sentiment:
LOAD
'$(text)' as text,
status as sentiment_status,
score as sentiment_score,
If (score<0, 'Negative' , 'Positive' ) as Score_flag
FROM ..
Thank you very much Tres