Input
- Input table: sentiment_extract_input, as in SentimentExtractor Example: InputModelFile ('dictionary'), AnalysisType ('document')
- Dict: sentiment_word, as in SentimentExtractor Example: Dictionary Table Instead of Model File
- InputModelFile: custom_sentiment_lexicon.txt, which looks like this:
excellent 1 disappointed -1 junk -4 mistake -4 flutter 1 fond 1 fondly 1 inspiring 1 enjoy 3 happy 4 love 3 nice 2 hate -3 complaints -5 good 4 poor -1
SQL Call
If the SQL call uses both InputModelFile (default or custom) and a dictionary table, then the dictionary table overrides the InputModelFile when they conflict.
SELECT * FROM SentimentExtractor ( ON sentiment_extract_input PARTITION BY ANY ON sentiment_word AS Dict DIMENSION USING InputModelFile ('dictionary: custom_sentiment_lexicon.txt') TextColumn ('review') 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 2, excellent 2. In total, positive score:4 negative score:0 2 office suite POS 2 terrific 2, terrific 2. In total, positive score:4 negative score:0 3 camera POS 2 nice 1, good 4. In total, positive score:5 negative score:0 4 gps POS 2 outstanding 2, incredible 2. In total, positive score:4 negative score:0 5 gps POS 2 nice 1, big 0, good 4. In total, positive score:5 negative score:0 6 gps NEG 2 complaints -5. In total, positive score:0 negative score:-5 7 gps POS 2 messed 2. In total, positive score:2 negative score:0 8 camera NEG 2 hate -3, stuck -1, difficulty -1. In total, positive score:0 negative score:-5 9 television NEG 2 junk -2, poor -1, big 0. In total, positive score:0 negative score:-3 10 camera NEG 2 not tolerate -1, constant 0. In total, positive score:0 negative score:-1