Natural Language Processing · TEE · papers

Q1c · Sentiment feature extraction

2023-12-01 · final · recovered AI paper

Previous examination · complete worked answers

Question. Extract x₁ = log₁₀(word count), x₂ = count of positive lexicon words and x₃ = count of negative lexicon words from: “I was amazed at how the product quickly it arrived. The customer service was exceptional. The support team responded promptly and professionally. I was not sad with my decision. Overall, my experience with them was outstanding.” Positive lexicon={amazed,promptly,outstanding,great}; negative={horrible,sad,disgusting}. [5 marks]

Answer

Given

I was amazed at how the product quickly it arrived. The customer service was exceptional. The support team responded promptly and professionally. I was not sad with my decision. Overall, my experience with them was outstanding.

To find

The three numerical features.

Formula: which one and why

Use word tokens after stripping punctuation, keep stopwords, and match only the supplied lexicons. Raw lexicon counting does not automatically reverse a word under negation.

Step 1. List and count every word

PositionWord
1i
2was
3amazed
4at
5how
6the
7product
8quickly
9it
10arrived
11the
12customer
13service
14was
15exceptional
16the
17support
18team
19responded
20promptly
21and
22professionally
23i
24was
25not
26sad
27with
28my
29decision
30overall
31my
32experience
33with
34them
35was
36outstanding

Step 2. Apply the logarithm

x_1=\log_{10}36=1.556302501LaTeX: x_1=\log_{10}36=1.556302501

Step 3. Count positive matches

amazed, promptly, outstanding each occur once. great does not occur. x₂=3. exceptional is not in the supplied lexicon, so it is not counted.

Step 4. Count negative matches

sad occurs once; horrible and disgusting do not. x₃=1. The phrase “not sad” remains one raw negative-lexicon occurrence under the specified feature definition.

Final answer

(x₁,x₂,x₃)=(1.556302501,3,1).