1.1 - 8.10 - SentimentExtractor Example: InputModelFile ('dictionary'), AnalysisType ('sentence') - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.1
8.10
Release Date
October 2019
Content Type
Programming Reference
Publication ID
B700-4003-079K
Language
English (United States)

This example uses the dictionary model file default_sentiment_lexicon.txt.

SQL Call

SELECT * FROM SentimentExtractor (
  ON sentiment_extract_input
  USING
  TextColumn ('review')
  InputModelFile ('dictionary')
  AnalysisType ('sentence')
  Accumulate ('id', 'product')
) AS dt ORDER BY id;

Output

 id product      out_content                                                                                                                                                                                                                                                                        out_polarity out_strength out_sentiment_words                                                                                       
 -- ------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------ ------------ --------------------------------------------------------------------------------------------------------- 
  1 camera       we primarily bought this camera for high image quality and excellent video capability without paying the price for a dslr  .it has excelled in what we expected of it , and consequently represented excellent value for me  .all my friends want my camera for their vacations  . POS                     2 excellent 1, capability 1, excelled 1, excellent 1. In total, positive score:4 negative score:0          
  1 camera       i would recommend this camera to anybody  .definitely worth the price  .plus , when you buy some accessories , it becomes even more powerful                                                                                                                                       POS                     2 recommend 1, worth 1, powerful 1. In total, positive score:3 negative score:0                            
  2 office suite the fact that i could comfortable import xls , doc , ppt and modify them , and then export them back to the doc , xls , ppt is terrific .                                                                                                                                          POS                     2 comfortable 1, terrific 1. In total, positive score:2 negative score:0                                   
  2 office suite it is launched before office 2010 and it is ages ahead of it already  .                                                                                                                                                                                                            NEU                     0                                                                                                          
  2 office suite i needed the compatibility  .it is a very intuitive suite and the drag    drop functionality is terrific .                                                                                                                                                                         POS                     2 intuitive 1, drag -1, terrific 1. In total, positive score:2 negative score:-1                           
  2 office suite it is the best office suite i have used to date  .                                                                                                                                                                                                                                 POS                     2 best 1. In total, positive score:1 negative score:0                                                      
  3 camera       this is a nice camera , delivering good quality video images decent photos  .                                                                                                                                                                                                      POS                     2 nice 1, good 1, decent 1. In total, positive score:3 negative score:0                                    
  4 gps          outstanding performance ,  works great .                                                                                                                                                                                                                                           POS                     2 outstanding 1, works 1, great 1. In total, positive score:3 negative score:0                             
  4 gps          it is a fine gps .                                                                                                                                                                                                                                                                 POS                     2 fine 1. In total, positive score:1 negative score:0                                                      
  4 gps          you can even get incredible coordinate accuracy from streets and trips to compare .                                                                                                                                                                                                POS                     2 incredible 1. In total, positive score:1 negative score:0                                                
  5 gps          great job.                                                                                                                                                                                                                                                                         POS                     2 great 1. In total, positive score:1 negative score:0                                                     
  5 gps          big display , good backlight , really watertight , training assistant .i use in trail running and  it worked well through out the race                                                                                                                                             POS                     2 good 1, worked 1, well 1. In total, positive score:3 negative score:0                                    
  5 gps          nice graphs and map route info  .i would not run outside again without this unique gadget  .                                                                                                                                                                                       POS                     2 nice 1. In total, positive score:1 negative score:0                                                      
  6 gps          i wish i could make all the rating stars be empty .                                                                                                                                                                                                                                NEU                     0                                                                                                          
  6 gps          i have never seen so many mistakes do to what i think has to be none update of data to the system .                                                                                                                                                                                NEG                     2 mistakes -1. In total, positive score:0 negative score:-1                                                
  6 gps          most of the complaints i have seen in here are from a lack of rtfm.                                                                                                                                                                                                                NEG                     2 complaints -1, lack -1. In total, positive score:0 negative score:-2                                     
  7 gps          i found their website support difficult to navigate .                                                                                                                                                                                                                              NEU                     0 support 1, difficult -1. In total, positive score:1 negative score:-1                                    
  7 gps          i am is so disapointed and just returned it and now looking for another one                                                                                                                                                                                                        NEG                     2 disapointed -1. In total, positive score:0 negative score:-1                                             
  7 gps          on my way home from a friends house it told me there is no possible route  .                                                                                                                                                                                                       NEU                     0                                                                                                          
  7 gps          this machine is all screwed up  .                                                                                                                                                                                                                                                  NEG                     2 screwed -1. In total, positive score:0 negative score:-1                                                 
  8 camera       horrible indoors , does not capture fast action, screwy software , no suprise , and screwy audio/video codec that does not work with hardly any app                                                                                                                                NEG                     2 horrible -1, not fast -1, screwy -1, screwy -1, not work -1. In total, positive score:0 negative score:-5
  8 camera       this camera sucks so bad , even the dealers on ebay have difficulty selling it.                                                                                                                                                                                                    NEG                     2 sucks -1, bad -1, difficulty -1. In total, positive score:0 negative score:-3                            
  8 camera       i hate my camera , and im stuck with it  .                                                                                                                                                                                                                                         NEG                     2 hate -1, stuck -1. In total, positive score:0 negative score:-2                                          
  9 television   product is very inferior and subject to several lawsuits  .                                                                                                                                                                                                                        NEG                     2 inferior -1. In total, positive score:0 negative score:-1                                                
  9 television   i expressed my dissatifaction with the situation as this is a known issue                                                                                                                                                                                                          NEG                     2 issue -1. In total, positive score:0 negative score:-1                                                   
  9 television   after about 1 and a half years and hardly using the tv , a big yellow pixilated stain appeared.                                                                                                                                                                                    NEG                     2 stain -1. In total, positive score:0 negative score:-1                                                   
  9 television   $3k is way too much money to drop onto a piece of crap .poor customer support .                                                                                                                                                                                                    NEG                     2 crap -1, poor -1, support 1. In total, positive score:1 negative score:-2                                
 10 camera       due to the constant need for repair , i would never recommend this product  .                                                                                                                                                                                                      NEG                     2 never recommend -1. In total, positive score:0 negative score:-1                                         
 10 camera       i returned my camera to the vendor as i will not tolerate a sub standard product that is a known issue especially from vendor who will not admt that this needs to be removed from the shelf due to failing parts updated  .                                                       NEG                     2 issue -1, failing -1. In total, positive score:0 negative score:-

Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.