Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left
Apply NowLogin using Social Account
     Continue with GoogleLogin using your credentials
In this step, we will create l1
, l2
, and l3
views which will help us in calculating the sentiment of each tweet.
Question-
What is the polarity of word "crushes"?
Launch hive console by typing the hive
command in the web console.
hive
Create view l1
. Thel1
view converts each tweet into a lower case and explodes it into a list of words. Run below command in Hive on your web console.
create view l1 as select id, words from tweets_raw lateral view explode(sentences(lower(text))) dummy as words;
Sample rows of view l1
are
Create view l2
. The l2
view stores every word of a tweet in a new row.
Run below command in Hive on your web console.
create view l2 as select id, word from l1 lateral view explode( words ) dummy as word ;
Sample rows of view l2
are
Create view l3
. The l3
view joins l2
view with the dictionary
table and stores the polarity of each word. Run below command in Hive on your web console.
create view l3 as select
id,
l2.word,
case d.polarity
when 'negative' then -1
when 'positive' then 1
else 0 end as polarity
from l2 left outer join dictionary d on l2.word = d.word;
Sample rows of view l3
are
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...