Repustate

The Qlik Repustate connector uses the Repustate API to fetch sentiment analytics for your textual data, such as tweets, messages, or comments. The Repustate connector also lets you classify blocks of text and label parts of speech.

Note:

In previous versions of the Qlik Web Connectors, the Repustate API was accessible through the Sentiment and Text Analytics Connector.

Ways to access your data

To access the Repustate API, you need to authenticate the connector with a Repustate API key.

Loading data from tables

Table Description
Usage Use this table to fetch the status of the Repustate API.
Sentiment Use this table to fetch a single sentiment score for the full text.
SentimentByTopic Use this table to fetch the sentiment score for text sorted by named topics.
SentimentChunked Use this table to fetch the sentiment score for text grouped into chunks.
Categorise Use this table to fetch the sentiment score for text sorted into industry-specific categories.
PartsOfSpeech Use this table to fetch the parts of speech for each word in a block of text.
DetectLanguage Use this table to fetch the language of a block of text.
Themes Use this table to fetch the themes of a block of text.
Entities Use this table to fetch the entity classification for terms within a block of text.
Note: The Repustate API supports Arabic, Chinese, Dutch, English, French, German, Hebrew, Italian, Polish, Portuguese, Russian, Spanish, Thai, Turkish, and Vietnamese. English is the default language.

Analyzing text

The most effective way to use the Repustate connector is to have a script pass rows of data to the Repustate API to generate a new table with sentiment scores for each row of data.

Using a For/Next loop

Example:  

LET noRows = NoOfRows('Timeline');   for i=0 to $(noRows)-1   let text = Peek('text', $(i), 'Timeline'); RepustateConnector_Sentiment: LOAD score as Sentiment_score, status as Sentiment_status FROM [http://localhost:5555/data?connectorID=TextAnalyser_RepustateConnector&table=Sentiment&text=$(TextEncoded)&Language=en&appID=&loadAccessToken=1h7jh3i6h3o7k] (qvx); next

Peek - script function

NoOfRows - chart function

Note: In the above script the table name Sentiment contains the sentiment API being used.
Text is not URL encoded

If you are using text data from a source which is not already URL encoded, you can write a script that encodes the text before sending it to the sentiment analyzer.

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   call=str;   End sub  LET noRows = NoOfRows('Timeline');   for i=0 to $(noRows)-1   let text = Peek('text', $(i), 'Timeline'); RepustateConnector_Sentiment: LOAD score as Sentiment_score, status as Sentiment_status FROM [http://localhost:5555/data?connectorID=TextAnalyser_RepustateConnector&table=Sentiment&text=$(TextNotEncoded)&Language=en&appID=&loadAccessToken=1h7jh3i6h3o7k] (qvx); next
Note: URL encoding should be done using UTF-8.

Caching

The sentiment analyzer caches the sentiment scores. If you want to clear the cache, follow the instructions here, Clearing the Qlik Web Connectors cache.

Backing Up The Cache

The cache will grow to a considerable size and retrieving items from the cache will be significantly faster than accessing the sentiment API. For this reason it is recommended that you take regular backups of this cache so that it can be restored if necessary.

By default the cache can be found at the following location:

[INSTALLATION_DIR]\[Web_connector_folder]\App_Data\[USER_GUID]\TextAnalyser_RepustateConnector_Cache

Working with the Repustate API quota limits

The Qlik Web Connectors call the Repustate API to provide sentiment analysis on your data and load it into your Qlik Sense app. While reloading you Repustate-based app, you might receive an error message that the connector has reached the Repustate API rate limit and that all subsequent API calls will fail until the connector falls back under the throttling limit. If you receive this error message, then you have exceeded the API rate limit.

You receive an error message that you have reached the API rate limit

Reference - Repustate documentation

You can refer to the Repustate API documentation to learn more about requirements and restrictions imposed by the Repustate API.

Troubleshooting

You receive an error message that you have reached the API rate limit

Possible cause  

You have exceeded the API limits that are imposed on the Qlik Web Connectors by the Repustate API.

Proposed action  

To reduce the impact of reaching the API rate limit, develop your app with the following in mind:

  • Extract only the data you need.
  • Reload one Repustate-based application at a time.
  • Ensure that loops in your script that make API calls will not result in infinite loops.

Did this information help you?

Can you tell us why it did not help you and how we can improve it?