1.1 - 8.10 - SentimentExtractor Example: InputModelFile ('dictionary'), AnalysisType ('document') - 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.

Input

sentiment_extract_input
id product category review
1 camera POS 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. i would recommend this camera to anybody. definitely worth the price. plus, when you buy some accessories, it becomes even more powerful.
2 office suite POS it is the best office suite i have used to date. it is launched before office 2010 and it is ages ahead of it already. 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. i needed the compatibility. it is a very intuitive suite and the drag drop functionality is terrific.
3 camera POS this is a nice camera, delivering good quality video images decent photos. light small, using easily obtainable, high quality minidv i love it. minor irritations include touchscreen based menu only digital photos can only be transferred via usb, requiring ilink and usb if you use ilink.
4 gps POS it is a fine gps. outstanding performance, works great. you can even get incredible coordinate accuracy from streets and trips to compare.
5 gps POS nice graphs and map route info. i would not run outside again without this unique gadget. great job. big display, good backlight, really watertight, training assistant. i use in trail running and it worked well through out the race.
6 gps NEG most of the complaints i have seen in here are from a lack of rtfm. i have never seen so many mistakes do to what i think has to be none update of data to the system. i wish i could make all the rating stars be empty.
7 gps NEG this machine is all screwed up. on my way home from a friends house it told me there is no possible route. i found their website support difficult to navigate. i am is so disappointed and just returned it and now looking for another one
8 camera NEG i hate my camera, and im stuck with it. this camera sucks so bad, even the dealers on ebay have difficulty selling it. horrible indoors, does not capture fast action, screwy software, no suprise, and screwy audio/video codec that does not work with hardly any app.
9 television NEG $3k is way too much money to drop onto a piece of crap. poor customer support. after about 1 and a half years and hardly using the tv, a big yellow pixilated stain appeared. product is very inferior and subject to several lawsuits. i expressed my dissatisfaction with the situation as this is a known issue.
10 camera NEG 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 admit that this needs to be removed from the shelf due to failing parts updated. due to the constant need for repair, i would never recommend this product.

SQL Call

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

Output

 id product      out_polarity out_strength out_sentiment_words                                                                                                                                            
 -- ------------ ------------ ------------ -------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  1 camera       POS                     2 excellent 1, capability 1, excelled 1, excellent 1, recommend 1, worth 1, powerful 1. In total, positive score:7 negative score:0                             
  2 office suite POS                     2 best 1, comfortable 1, terrific 1, intuitive 1, drag -1, terrific 1. In total, positive score:5 negative score:-1                                             
  3 camera       POS                     2 nice 1, good 1, decent 1. In total, positive score:3 negative score:0                                                                                         
  4 gps          POS                     2 fine 1, outstanding 1, works 1, great 1, incredible 1. In total, positive score:5 negative score:0                                                            
  5 gps          POS                     2 nice 1, great 1, good 1, worked 1, well 1. In total, positive score:5 negative score:0                                                                        
  6 gps          NEG                     2 complaints -1, lack -1, mistakes -1. In total, positive score:0 negative score:-3                                                                             
  7 gps          NEG                     2 screwed -1, support 1, difficult -1, disapointed -1. In total, positive score:1 negative score:-3                                                             
  8 camera       NEG                     2 hate -1, stuck -1, sucks -1, bad -1, difficulty -1, horrible -1, not fast -1, screwy -1, screwy -1, not work -1. In total, positive score:0 negative score:-10
  9 television   NEG                     2 crap -1, poor -1, support 1, stain -1, inferior -1, issue -1. In total, positive score:1 negative score:-5                                                    
 10 camera       NEG                     2 issue -1, failing -1, never recommend -1. In total, positive score:0 negative score:-3

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