Search This Blog

Wednesday 22 March 2017

TWITTER SENTIMENT ANALYSIS

TWITTER SENTIMENT ANALYSIS OF SUSHMASWARAJ TWEETS

STEP1:  CRATE TWITTER APP AND USING FLUME GAT DATA INTO HDFS

add jar /home/training/hive-serdes-1.0-SNAPSHOT.jar;  



  create external table load_tweets(id BIGINT,text STRING) ROW FORMAT SERDE 'com.cloudera.hive.serde.JSONSerDe' LOCATION '/user/training/tweet_data'


create table split_words as select id as id,split(text,'') as words from load_tweets;

create table split_words1 as select id as id,split(text,' ') as words from load_tweets;

create table tweet_word as select id as id,word from split_words1 LATERAL VIEW explode(words) w as word;

create table dictionary(word string,rating int) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';

LOAD DATA local INPATH '/AFINN.txt' overwrite into TABLE dictionary;

create table word_join as select tweet_word.id,tweet_word.word,dictionary.rating from tweet_word LEFT OUTER JOIN dictionary ON(tweet_word.word =dictionary.word);

select id,AVG(rating) as rating from word_join GROUP BY id order by rating DESC;
844464313704333313      2.5
844463827383148544      2.0
844463614144757760      0.3333333333333333
844463980957585408      -0.5
844463665613078528      NULL
844463761977217024      NULL
844463783229771776      NULL
844463950196563969      NULL
844464289498959873      NULL
844464368758738944      NULL
Time taken: 30.749 seconds


844463827383148544              NULL
844463827383148544              NULL
844463980957585408      .@SushmaSwaraj  NULL
844463827383148544      0572711467      NULL
844463665613078528      2       NULL
844463665613078528      4yrs    NULL
844463827383148544      @KTRTRS NULL
844463827383148544      @MinIT_Telangana        NULL
844464313704333313      @SushmaSwaraj   NULL
844463614144757760      @SushmaSwaraj   NULL
844464368758738944      @SushmaSwaraj   NULL
844463665613078528      @SushmaSwaraj   NULL
844464289498959873      @SushmaSwaraj   NULL
844463783229771776      @SushmaSwaraj   NULL
844463950196563969      @SushmaSwaraj   NULL
844463827383148544      @SushmaSwaraj   NULL
844464289498959873      @narendramodi   NULL
844464368758738944      @narendramodi   NULL
844463950196563969      @narendramodi   NULL
844463783229771776      @narendramodi   NULL
844463614144757760      @sidbakaria:    NULL
844463980957585408      @the_hindu:     NULL
844463665613078528      For     NULL
844463980957585408      Indian  NULL
844463614144757760      Indian  NULL
844464313704333313      Mam     NULL
844463614144757760      Pakistan        NULL
844463980957585408      Pakistan        NULL
844463614144757760      RT      NULL
844463980957585408      RT      NULL
844464313704333313      Varanasi,       NULL
844463614144757760      a       NULL
844464313704333313      a       NULL
844463980957585408      abuse   -3
844463614144757760      abuse   -3
844463614144757760      action  NULL
844463665613078528      advrs   NULL
844463665613078528      after   NULL
844464313704333313      and     NULL
844464313704333313      at      NULL
844463665613078528      auty    NULL
844463614144757760      bold    2
844463614144757760      by      NULL
844464313704333313      changed NULL
844463827383148544      contact NULL
844464313704333313      culture NULL
844463614144757760      domestic        NULL
844463980957585408      domestic        NULL
844464313704333313      employees,      NULL
844463614144757760      facing  NULL
844463980957585408      facing  NULL
844463665613078528      find    NULL
844464313704333313      for     NULL
844464313704333313      for     NULL
844463665613078528      frm     NULL
844464313704333313      govt    NULL
844464313704333313      great   3
844463665613078528      harass  NULL
844463827383148544      help    2
844463614144757760      her     NULL
844463950196563969      https://t.co/17WxvmHR91 NULL
844463783229771776      https://t.co/AvVONnyWde NULL
844463783229771776      https://t.co/L4eotZ6gig NULL
844464289498959873      https://t.co/VuZ5JcBhRm NULL
844463980957585408      https://t.co/XMXO0YSN2T NULL
844464289498959873      https://t.co/oLJBcmRnp5 NULL
844464368758738944      https://t.co/pXZtG2sY9K NULL
844463761977217024      https://t.co/rCaIpzj1f1 NULL
844463950196563969      https://t.co/s7sBWbzNf0 NULL
844464368758738944      https://t.co/tIQ8mydfY6 NULL
844463827383148544      im.     NULL
844463980957585408      in      NULL
844463980957585408      in      NULL
844463614144757760      in      NULL
844463614144757760      in      NULL
844463665613078528      it      NULL
844463614144757760      ji      NULL
844463665613078528      made.Always     NULL
844464313704333313      making  NULL
844463827383148544      mem.    NULL
844463665613078528      minor   NULL
844463827383148544      mohtasim.       NULL
844464313704333313      my      NULL
844463827383148544      n.      NULL
844463665613078528      ntce    NULL
844464313704333313      offices NULL
844463665613078528      passport        NULL
844463665613078528      passprt NULL
844464313704333313      perception      NULL
844463665613078528      police  NULL
844463665613078528      ppl     NULL
844464313704333313      proud.  NULL
844464313704333313      psk     NULL
844463665613078528      rcvd    NULL
844463614144757760      really  NULL
844463980957585408      rescue  2
844463614144757760      rescue  2
844463665613078528      rport   NULL
844463827383148544      saudia. NULL
844463665613078528      smthing NULL
844463665613078528      son's   NULL
844463614144757760      steps   NULL
844463980957585408      steps   NULL
844463614144757760      taken   NULL
844464313704333313      thank   2
844463614144757760      to      NULL
844463980957585408      to      NULL
844464313704333313      u       NULL
844464313704333313      us      NULL
844463665613078528      was     NULL
844464313704333313      what    NULL
844463980957585408      woman   NULL
844463614144757760      woman   NULL

DICTIONARY WORDS:

screwed up      -3
scumbag -4
secure  2
secured 2
secures 2
sedition        -2
seditious       -2
seduced -1
self-confident  2
self-deluded    -2
selfish -3
selfishness     -3
sentence        -2
sentenced       -2
sentences       -2
sentencing      -2
serene  2
severe  -2
sexy    3
shaky   -2
shame   -2
shamed  -2
shameful        -2
share   1
shared  1
shares  1
shattered       -2
shit    -4
shithead      
shitty  -3
shock   -2
shocked -2
shocking        -2
shocks  -2
shoot   -1
short-sighted   -2
short-sightedness       -2
shortage        -2
shortages       -2
shrew   -4
shy     -1
sick    -2
sigh    -2
significance    1
significant     1
silencing       -1
silly   -1
sincere 2
sincerely       2
sincerest       2
sincerity       2
sinful  -3
singleminded    -2
skeptic -2
skeptical       -2
skepticism      -2
skeptics        -2
slam    -2
slash   -2
slashed -2
slashes -2
slashing        -2
slavery -3
sleeplessness   -2
slick   2
slicker 2
slickest        2
sluggish        -2
slut    -5
smart   1
smarter 2
smartest        2
smear   -2
smile   2
smiled  2
smiles  2
smiling 2
smog    -2
sneaky  -1
snub    -2
snubbed -2
snubbing        -2
snubs   -2
sobering        1
solemn  -1
solid   2
solidarity      2
solution        1
solutions       1
solve   1
solved  1
solves  1
solving 1
somber  -2
some kind       0
son-of-a-bitch  -5
soothe  3
soothed 3
soothing        3
sophisticated   2
sore    -1
sorrow  -2
sorrowful       -2
sorry   -1
spam    -2
spammer -3
spammers        -3
spamming        -2
spark   1
sparkle 3
sparkles        3
sparkling       3
speculative     -2
spirit  1
spirited        2
spiritless      -2
spiteful        -2
splendid        3
sprightly       2
squelched       -1
stab    -2
stabbed -2
stable  2
stabs   -2
stall   -2
stalled -2
stalling        -2
stamina 2
stampede        -2
startled        -2
starve  -2
starved -2
starves -2
starving        -2
steadfast       2
steal   -2
steals  -2
stereotype      -2
stereotyped     -2
stifled -1
stimulate       1
stimulated      1
stimulates      1
stimulating     2
stingy  -2
stolen  -2
stop    -1
stopped -1
stopping        -1
stops   -1
stout   2
straight        1
strange -1
strangely       -1
strangled       -2
strength        2
strengthen      2
strengthened    2
strengthening   2
strengthens     2
stressed        -2
stressor        -2
stressors       -2
stricken        -2
strike  -1
strikers        -2
strikes -1
strong  2
stronger        2
strongest       2
struck  -1
struggle        -2
struggled       -2
struggles       -2
struggling      -2
stubborn        -2
stuck   -2
stunned -2
stunning        4
stupid  -2
stupidly        -2
suave   2
substantial     1
substantially   1
subversive      -2
success 2
successful      3
suck    -3
sucks   -3
suffer  -2
suffering       -2
suffers -2
suicidal        -2
suicide -2
suing   -2
sulking -2
sulky   -2
sullen  -2
sunshine        2
super   3
superb  5
superior        2
support 2
supported       2
supporter       1
supporters      1
supporting      1
supportive      2
supports        2
survived        2
surviving       2
survivor        2
suspect -1
suspected       -1
suspecting      -1
suspects        -1
suspend -1
suspended       -1
suspicious      -2
swear   -2
swearing        -2
swears  -2
sweet   2
swift   2
swiftly 2
swindle -3
swindles        -3
swindling       -3
sympathetic     2
sympathy        2
tard    -2
tears   -2
tender  2
tense   -2
tension -1
terrible        -3
terribly        -3
terrific        4
terrified       -3
terror  -3
terrorize       -3
terrorized      -3
terrorizes      -3
thank   2
thankful        2
thanks  2
thorny  -2
thoughtful      2
thoughtless     -2
threat  -2
threaten        -2
threatened      -2
threatening     -2
threatens       -2
threats -2
thrilled        5
thwart  -2
thwarted        -2
thwarting       -2
thwarts -2
timid   -2
timorous        -2
tired   -2
tits    -2
tolerant        2
toothless       -2
top     2
tops    2
torn    -2
torture -4
tortured        -4
tortures        -4
torturing       -4
totalitarian    -2
totalitarianism -2
tout    -2
touted  -2
touting -2
touts   -2
tragedy -2
tragic  -2
tranquil        2
trap    -1
trapped -2
trauma  -3
traumatic       -3
travesty        -2
treason -3
treasonous      -3
treasure        2
treasures       2
trembling       -2
tremulous       -2
tricked -2
trickery        -2
triumph 4
triumphant      4
trouble -2
troubled        -2
troubles        -2
true    2
trust   1
trusted 2
tumor   -2
twat    -5
ugly    -3
unacceptable    -2
unappreciated   -2
unapproved      -2
unaware -2
unbelievable    -1
unbelieving     -1
unbiased        2
uncertain       -1
unclear -1
uncomfortable   -2
unconcerned     -2
unconfirmed     -1
unconvinced     -1
uncredited      -1
undecided       -1
underestimate   -1
underestimated  -1
underestimates  -1
underestimating -1
undermine       -2
undermined      -2
undermines      -2
undermining     -2
undeserving     -2
undesirable     -2
uneasy  -2
unemployment    -2
unequal -1
unequaled       2
unethical       -2
unfair  -2
unfocused       -2
unfulfilled     -2
unhappy -2
unhealthy       -2
unified 1
unimpressed     -2
unintelligent   -2
united  1
unjust  -2
unlovable       -2
unloved -2
unmatched       1
unmotivated     -2
unprofessional  -2
unresearched    -2
unsatisfied     -2
unsecured       -2
unsettled       -1
unsophisticated -2
unstable        -2
unstoppable     2
unsupported     -2
unsure  -1
untarnished     2
unwanted        -2
unworthy        -2
upset   -2
upsets  -2
upsetting       -2
uptight -2
urgent  -1
useful  2
usefulness      2
useless -2
uselessness     -2
vague   -2
validate        1
validated       1
validates       1
validating      1
verdict -1
verdicts        -1
vested  1
vexation        -2
vexing  -2
vibrant 3
vicious -2
victim  -3
victimize       -3
victimized      -3
victimizes      -3
victimizing     -3
victims -3
vigilant        3
vile    -3
vindicate       2
vindicated      2
vindicates      2
vindicating     2
violate -2
violated        -2
violates        -2
violating       -2
violence        -3
violent -3
virtuous        2
virulent        -2
vision  1
visionary       3
visioning       1
visions 1
vitality        3
vitamin 1
vitriolic       -3
vivacious       3
vociferous      -1
vulnerability   -2
vulnerable      -2
walkout -2
walkouts        -2
wanker  -3
want    1
war     -2
warfare -2
warm    1
warmth  2
warn    -2
warned  -2
warning -3
warnings        -3
warns   -2
waste   -1
wasted  -2
wasting -2
wavering        -1
weak    -2
weakness        -2
wealth  3
wealthy 2
weary   -2
weep    -2
weeping -2
weird   -2
welcome 2
welcomed        2
welcomes        2
whimsical       1
whitewash       -3
whore   -4
wicked  -2
widowed -1
willingness     2
win     4
winner  4
winning 4
wins    4
winwin  3
wish    1
wishes  1
wishing 1
withdrawal      -3
woebegone       -2
woeful  -3
won     3
wonderful       4
woo     3
woohoo  3
wooo    4
woow    4
worn    -1
worried -3
worry   -3
worrying        -3
worse   -3
worsen  -3
worsened        -3
worsening       -3
worsens -3
worshiped       3
worst   -3
worth   2
worthless       -2
worthy  2
wow     4
wowow   4
wowww   4
wrathful        -3
wreck   -2
wrong   -2
wronged -2
wtf     -4
yeah    1
yearning        1
yeees   2
yes     1
youthful        2
yucky   -2
yummy   3
zealot  -2
zealots -2
zealous 2
Time taken: 0.243 seconds
hive>



No comments:

Post a Comment

Hadoop Analytics

NewolympicData

  Alison Bartosik 21 United States 2004 08-29-04 Synchronized Swimming 0 0 2 2 Anastasiya Davydova 21 Russia 2004 0...