Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Somy
Partner - Contributor II
Partner - Contributor II

Using Sentiment Analysis

Hi all,

I'm new in sentiment140 web connector in Qlik Sense. I found some documents about Sentiment 140 Qlik web connector, but it works very slow. Is there any way to optimize it?

 

let vQwcConnectionName = 'lib://----------------';

Sub urlEncode(str)

let str=replace(str, '%', '%25'); // should be first
let str=replace(str, '#', '%23');
let str=replace(str, ' ', '%20');
let str=replace(str, '$', '%24');
let str=replace(str, '&', '%26');
let str=replace(str, '+', '%2B');
let str=replace(str, ',', '%2C');
let str=replace(str, '/', '%2F');
let str=replace(str, '\', '%5C');
let str=replace(str, ':', '%3A');
let str=replace(str, ';', '%3B');
let str=replace(str, '=', '%3D');
let str=replace(str, '?', '%3F');
let str=replace(str, '@', '%40');
let str=replace(str, '[', '%5B');
let str=replace(str, ']', '%5D');
let str=replace(str, '>', '%3E');
let str=replace(str, '<', '%3C');
let str=replace(str, chr(10), '%0A'); // Line feed.
let str=replace(str, chr(39), '%27'); // 39 Apostrophe

End sub


LET noRows = NoOfRows('TwitterConnector_Search');

for i=0 to $(noRows)-1

let text = peek('Search_text', $(i), 'TwitterConnector_Search');
let textEncoded = text;
call urlEncode(textEncoded);

Sentiment:
LOAD
'$(text)' as text,
status as Sentiment_status,
text as Sentiment_text,
score as Sentiment_score
FROM [$(vQwcConnectionName)]
(URL IS [http://localhost:5555/data?connectorID=TextAnalyser_Sentiment140Connector&table=Sentiment&text=$(tex...);

 

Any help would be greatly appreciated!

Labels (1)
1 Reply
chrisbrain
Partner - Specialist II
Partner - Specialist II

Hi,

This page may help:

https://help.qlik.com/en-US/connectors/Subsystems/Web_Connectors_help/Content/Connectors_QWC/Fetchin...

It describes an advanced topic where instead of making multiple requests to a table inside a for/next loop, you can first store all the iterations of the parameters into a csv file and then point the connector to this to process in a more efficient way.

beeido.com - BI | Software | Qlik Integration Services
GitFirst - A CI/CD solution for Qlik Sense