Using Sentiment Analysis With Magnify Search

Sentiment analysis is the study of consumer feelings and attitudes towards a product or service, such as positive, negative, or neutral. You can use Magnify Search to analyze textual feedback provided in social media platforms, product reviews, and other searchable content.

To use sentiment analysis with Magnify Search, the following requirements are needed.

The following HOLD FORMAT MAGNIFY procedure shows the code line SCORERESULT AS 'IBI_Sentiment_score' added to the procedure.

ENGINE MAGNIFY SET CONNECTION_ATTRIBUTES MY_PC ''
APP MAP SENT_MAG "C:/ibi/webfocus82/magnify/feedcache"
APP HOLD SENT_MAG
ENGINE MAGNIFY SET BASEURL=http://localhost:8080/ibi_apps/WFServlet
ENGINE MAGNIFY SET MIME=text/plain
ENGINE MAGNIFY SET DATASOURCE=sentiment
SET ASNAMES=MIXED

JOIN TEXT1 IN twitter/trump_v_clinton TO TEXT IN wand/wandscore

DEFINE FILE twitter/trump_v_clinton
	S_HARDCODED/TX50='Election 2016';
	TITLE_URL/A2000='http://localhost:8080/ibi_apps/search?q=' || NAME || '&' ||
          'collections=collections_sentiment.xml' || '&' || 
          'proxystylesheet=en/en_stylesheet_sentiment' || '&' || 
          'site=sentiment';
	LINK_DISPLAY_NAME1/A2000= SCREEN_NAME;
	LINK_URL1/A512='http://localhost:8080/ibi_apps/search?q=' || SCREEN_NAME || '&' ||
          'collections=collections_sentiment.xml' || '&' || 
          'proxystylesheet=en/en_stylesheet_sentiment' || '&' || 
          'site=sentiment';
	Sentiment_Score/A7 = IF SCORERESULT LT 0 THEN 'Bad'
          ELSE IF SCORERESULT EQ 0 THEN 'Neutral'
          ELSE 'Good'; 
END
TABLE FILE twitter/trump_v_clinton
PRINT
     SCREEN_NAME AS 'SearchTitle'
     SCREEN_NAME AS 'MagnifyID'
     SCREEN_NAME AS 'WF_INDEX_UNIQUE_KEY'
     NAME AS 'C1_NAME'
     SCREEN_NAME AS 'C2_SCREEN_NAME'
     CREATED_AT AS 'S_CREATED_AT'
     TEXT1 AS 'S_TEXT1'
     NAME AS 'S_NAME'
     SCREEN_NAME AS 'S_SCREEN_NAME'
     SCORERESULT AS 'IBI_Sentiment_score'
     Sentiment_Score AS 'C3_Sentiment_Score'
     TITLE_URL
     LINK_DISPLAY_NAME1
     LINK_URL1
     S_HARDCODED
ON TABLE HOLD FORMAT MAGNIFY AS SENT_MAG
END

After the search index is created, when you search for a term in Magnify Search, you can filter your data so that you are only searching for results that most likely contain sentiment scores, such as product reviews.

The following image shows customer product reviews written for the Century Electronics tablet. Sentiment scores are included. In this example, the higher the decimal number is, the more positive the feedback.

Sentiment Scores for four search results

For more information about sentiment scores, see the Magnify Search End User Manual technical content.

WebFOCUS

Feedback