Skip to main content Skip to complementary content

Sentiment140

The Qlik Sentiment140 connector uses the Sentiment140 API to classify short strings, such as Tweets, into positive, neutral, or negative sentiment categories. The classification score is represented by a number: 1 (positive), 0 (neutral), or -1 (negative). The score is determined by keywords that appear in the text.

Information noteThis Sentiment140 connector is only available in Qlik Sense SaaS. For the client managed version, see Qlik Web Connectors: Sentiment140.

Supported offerings

  • Qlik Sense Business
  • Qlik Sense Enterprise SaaS

Ways to access your data

To access the Sentiment140 API to retrieve a sentiment score for your data, you can manually enter your text into the connector but this is not an effective way to analyze a large number of short strings. We recommend that you use one of the method below to quickly analyze a large number of strings. See, Analyzing text.

Creating a data source connection

Loading data from tables

Use the following table to fetch sentiment scores from your text strings.

Tables that can be loaded
Table Description
Sentiment Use this table to fetch sentiment scores for text strings.

To select and load data from a table, enter the required table parameters and click Preview data. Required parameters are marked with an asterisk (*) in the dialog. The table fields are displayed under the Data preview tab. You can select fields individually by selecting the box beside each field name. Select Insert script after you have made your selection.

Creating a connection and selecting data

Information noteSentiment140 API supports English and Spanish. English is the default language.

Analyzing text

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

Using a For/Next loop

For/next loops are often used to run a large number of API requests with Qlik Web Connectors. These modes let you extract the maximum performance from Qlik Web Connectors and minimize load time of the Qlik Sense application.

For example, if you run a large number of text messages through Sentiment140, it can result in a long load time.

Example: For/next loop

for i=0 to $(noRows)-1   let id = peek('Search_id', $(i), 'Tweets'); let textEncoded = peek('text_urlEncoded', $(i), 'Tweets');   Sentiment: LOAD '$(id)' as Search_id, status as [Sentiment.status], text as [Sentiment.text], score as [Sentiment.score],   SELECT status, text, score FROM Sentiment WITH PROPERTIES ( text='$(textEncoded)', query='', Language='en' );   next

Example:  

Peek - script function

NoOfRows - chart function

Working with the Sentiment140 API quota limits

The Qlik Web Connectors use the Sentiment140 API to fetch sentiment data from Sentiment140 and load it into your Qlik Sense app. While reloading you Sentiment140-based app, you might receive an error message that the connector has reached the Sentiment140 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 one of the API rate limits.

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

Reference - Sentiment140 developer documentation

You can refer to the Sentiment140 API documentation to learn more about the different ways to use the Sentiment140 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 Sentiment140 API.

Proposed action

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

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

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!