SentimentEvaluator Example: Model ('dictionary') - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.10
1.1
Published
October 2019
Language
English (United States)
Last Update
2019-12-31
dita:mapPath
ima1540829771750.ditamap
dita:ditavalPath
jsj1481748799576.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

This example uses the dictionary model file default_sentiment_lexicon.txt.

SQL Call

SELECT * FROM SentimentEvaluator (
  ON SentimentExtractor (
    ON sentiment_extract_input
    USING
    TextColumn ('review')
    Accumulate ('category')
    ModelFile ('dictionary')
  ) PARTITION BY 1
  USING
  ObservationColumn ('category')
  SentimentColumn ('out_polarity')
) AS dt;

Output

 evaluation_result                                                                  
 ---------------------------------------------------------------------------------- 
 positive record (total relevant, relevant, total retrieved): 5 5 5                
 recall and precision: 1.00 1.00                                                   
 negative record (total relevant, relevant, total retrieved): 5 5 5                
 recall and precision: 1.00 1.00                                                   
 positive and negative record (total relevant, relevant, total retrieved): 10 10 10
 recall and precision: 1.00 1.00

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