scieee Science in your language
[en] (orig)

Emotional state detection through text analysis

Abstract

Atualmente, as pessoas são submetidas a rotinas intensas e muitas vezes exaustivas para que possam acomodar todas as expectativas e realizar seus desejos, sejam pessoais ou profissionais. Trabalhadores que exercem suas profissões diurnas e durante a noite tornam-se estudantes universitários, mães que têm que acomodar sua jornada profissional com as tarefas domésticas e jovens que dividem seu tempo em vários estudos escolares e profissionais - muitas vezes tendo que ajudar nos os lares - são alguns exemplos de perfis de pessoas que correm o risco de ter um problema emocional. Apesar de atingir um grande número de pessoas, não é trivial saber quando alguém está a atingir seu limite, pois é impossível conectar fios e dispositivos que coletem dados por alguns dias para identificar problemas futuros. Além disso, o acesso a esse tipo de equipamento exige dinheiro e tempo, o que não é para todos. A abordagem proposta aqui é coletar dados para inferir o estado emocional atual, tais como (stress, fadiga, ansiedade, etc.) de forma não invasiva, transparente, barata, simples de usar e de fácil integração com outras sistemas, através da análise de textos curtos, como a troca de mensagens, redigidos através dos mecanismos de comunicação rápida hoje em voga (chats de e-mails e redes sociais, blogs, fóruns de discussão, SMS, etc.). Para isso, a ideia é ensinar o computador a identificar as pistas deixadas nas mensagens de texto que revelem o estado emocional do autor. Usando técnicas de aprendizado de máquina (machine learning) e mineração de texto, várias mensagens previamente coletadas de diferentes fontes serão analisadas a fim de criar um modelo que classifique o estado emocional. Posteriormente, usando esse modelo de classificação, novas mensagens de texto podem ser analisadas para inferir o estado emocional atual do autor. Após utilizar diferentes técnicas para extrair as emoções de textos, essas informações foram sintetizadas na criação um perfil emocional que foi utilizado em tarefas de classificação para identificar doenças como depressão, e prever comportamentos tanto individuais como coletivos, atingindo 98% de precisão na detecção de depressão.

Read accessible full text

Emotional state detection through text analysis

Author: Martins, Ricardo Alexandre Gonçalves Carotta
Year: 2022
Source: https://repositorium.uminho.pt/bitstreams/d7189568-8894-4769-a813-027128310038/download
Uni e sidade do Minho
Escola de Engenha ia
Rica do Alexand e Gonçal es Ca o a Ma ins
Feb ua y 2022
Rica do Ma ins
UMinho|2022
Emo ional s a e de ec ion h ough ex
analysis
Emo ional s a e de ec ion h ough ex analysis
Feb ua y 2022
Doc o al P og am in In o ma ics
Uni e sidade do Minho
Escola de Engenha ia
Rica do Alexand e Gonçal es Ca o a Ma ins
Wo k de eloped unde he supe ision o
Paulo No ais
Ped o Hen iques
Doc o al Thesis
Uni e sidade do Minho
Escola de Engenha ia
Emo ional s a e de ec ion h ough ex
analysis
COPYRIGHT AND TERMS OF USE OF THIS WORK BY A THIRD PARTY
This is academic wo k ha can be used by hi d pa ies as long as in e na ionally accep ed ules and good
p ac ices ega ding copy igh and ela ed igh s a e espec ed.
Acco dingly, his wo k may be used unde he license p o ided below.
I he use needs pe mission o make use o he wo k unde condi ions no p o ided o in he indica ed
licensing, hey should con ac he au ho h ough he Reposi o iUM o Uni e sidade do Minho.
License g an ed o he use s o his wo k
C ea i e Commons A ibuição-NãoCome cial-Compa ilhaIgual 4.0 In e nacional
CC BY-NC-SA 4.0
h ps://c ea i ecommons.o g/licenses/by-nc-sa/4.0/deed.p
ii
Acknowledgemen s
Fi s o all, I would like o hank he p o esso s Ped o Hen iques, Paulo No ais and José João Almeida o
all suppo , discussions and good imes du ing his wo k. Also, I would like o hank he ISLab membe s,
o all lunches, socce , and good ideas ha en iched his wo k.
Fo my amiliy: Luciana - lo e o my li e, Manuela - my li le p incess, hank you o emb ace one mo e
ime ano he c azy idea o mine. Wi hou you i couldn’ be possible !
Fo my pa en s and b o he , hank you o all posi i e wo ds and suppo du ing di icul imes.
A las , hank you o all iends - I will no ci e indi idually he e because I would be un ai i o ge
someone - whoo chee ed o his wo k. In many imes you ga e me inspi a ion o keep in he igh pa h.
iii

STATEMENT OF INTEGRITY
I he eby decla e ha ing conduc ed his academic wo k wi h in eg i y. I con i m ha I ha e no used
plagia ism o any o m o undue use o in o ma ion o alsi ica ion o esul s along he p ocess leading o
i s elabo a ion.
I u he decla e ha I ha e ully acknowledged he Code o E hical Conduc o he Uni e sidade do
Minho.
B aga
(Place)
(Rica do Alexand e Gonçal es Ca o a Ma ins)
i
Assinado po : RICARDO ALEXANDRE
GONÇALVES CAROTTA MARTINS
Num. de Iden i icação: BI32248997
Da a: 2022.03.08 09.31.34 GMT S anda d Time
Signa u e No Ve i ied
“Só le o a ce eza de que mui o pouco sei.” (Almi Sa e )
Resumo
De ecção do es ado emocional a a és de análise de ex os
A ualmen e, as pessoas são subme idas a o inas in ensas e mui as ezes exaus i as pa a que possam
acomoda odas as expec a i as e ealiza seus desejos, sejam pessoais ou p o issionais. T abalhado es
que exe cem suas p o issões diu nas e du an e a noi e o nam-se es udan es uni e si á ios, mães que
êm que acomoda sua jo nada p o issional com as a e as domés icas e jo ens que di idem seu empo
em á ios es udos escola es e p o issionais - mui as ezes endo que ajuda nos os la es - são alguns
exemplos de pe is de pessoas que co em o isco de e um p oblema emocional.
Apesa de a ingi um g ande núme o de pessoas, não é i ial sabe quando alguém es á a a ingi seu
limi e, pois é impossí el conec a ios e disposi i os que cole em dados po alguns dias pa a iden i ica
p oblemas u u os. Além disso, o acesso a esse ipo de equipamen o exige dinhei o e empo, o que não
é pa a odos. A abo dagem p opos a aqui é cole a dados pa a in e i o es ado emocional a ual, ais
como (
s ess
, adiga, ansiedade, e c.) de o ma não in asi a, anspa en e, ba a a, simples de usa e de
ácil in eg ação com ou as sis emas, a a és da análise de ex os cu os, como a oca de mensagens,
edigidos a a és dos mecanismos de comunicação ápida hoje em oga (cha s de e-mails e edes sociais,
blogs, ó uns de discussão, SMS, e c.).
Pa a isso, a ideia é ensina o compu ado a iden i ica as pis as deixadas nas mensagens de ex o que
e elem o es ado emocional do au o . Usando écnicas de ap endizado de máquina (
machine lea ning
)
e mine ação de ex o, á ias mensagens p e iamen e cole adas de di e en es on es se ão analisadas a
im de c ia um modelo que classi ique o es ado emocional. Pos e io men e, usando esse modelo de
classi icação, no as mensagens de ex o podem se analisadas pa a in e i o es ado emocional a ual do
au o .
Após u iliza di e en es écnicas pa a ex ai as emoções de ex os, essas in o mações o am sin e iza-
das na c iação um pe il emocional que oi u ilizado em a e as de classi icação pa a iden i ica doenças
como dep essão, e p e e compo amen os an o indi iduais como cole i os, a ingindo 98% de p ecisão
na de ecção de dep essão.
Pala as-cha e: Análise de Sen imen os, Ap endizado de Máquina, P ocessamen o de Linguagem Na-
u al
i
Abs ac
Emo ional s a e de ec ion h ough ex analysis
Daily a la ge numbe o people end up su e ing ca acciden s, hea a acks and emo ional p oblems
due o s ess. Some easons like seden a y li es yle and he poo quali y o li e expe ienced cu en ly a e
easily associa ed wi h hem in he li e a u e.
Despi e eaching a high numbe o people, i is non- i ial o igu e ou when someone is in his emo-
ional h eshold; especially when connec ing body senso s, he e is no al e na i e o collec da a. Fu -
he mo e, moni o ing emo ional s a e condi ions con inually equi es money and ime. Ou app oach o
collec human da a is he analysis o ex messages ga he ed om email o social ne wo ks cha s, blogs,
SMS’s, and o he as communica ion mechanisms popula a p esen . This app oach he e p oposed
and discussed is use ul o measu e up he cu en emo ional s a e (s ess, a igue, e c.) o a pe son in a
non-in asi e manne , anspa en , cheap, simple o use, and easy o ca y a ound h ough mobile de ices
usage.
To achie e his objec i e, he idea is o
each
he compu e o iden i y cues le in ex messages which
e eal he emo ional s a e o he au ho . By using machine lea ning and ex mining, se e al messages
p e iously collec ed om di e en sou ces a e analysed o c ea e a model which classi ies he emo ional
s a e. La e , using his classi ica ion model, new ex messages can be analysed o classi y he cu en
emo ional s a e.
A e pe o med di e en echniques o ex ac emo ions om ex s, hese in o ma ion we e used o
c ea e an emo ional p o ile ha was used in classi ica ion asks o iden i y diseases such as dep ession,
o p edic indi idual o g oup beha iou s, achie ing 98% p ecision in dep ession de ec ion.
Keywo ds: Machine Lea ning, Na u al Language P ocessing, Sen imen Analysis
ii
LIST OF FIGURES
23 Righ -Angled T iangle ................................. 55
24 WMD Example. Adap ed om [94] ........................... 56
25 Simila i y alues. Adap ed om [94] .......................... 56
26 Model’s a chi ec u e .................................. 61
27 Lea ning Module ................................... 61
28 Reques Classi ica ion pipeline ............................. 64
29 Reques Reg ession pipeline .............................. 66
30 P edic Emo ionalLe els pipeline ............................ 68
31 Da a P epa a ion pipeline ............................... 71
32 Emo ional P o ile pipeline ............................... 73
33 Emo ional P o ile pipeline example ........................... 73
34 Pe sonal lexicon c ea ion pipeline ........................... 74
35 Time Se ies Pe sonal Model Builde pipeline ...................... 76
36 Classi ica ion Model module pipeline ......................... 77
37 P ep ocessing asks .................................. 82
38 P ep ocessing ex example .............................. 83
39 Pola i ies dis ibu ion by ca ego y ........................... 83
40 Pola i ies dis ibu ion by au ho ............................ 84
41 Lexicon expansion p ocess .............................. 89
42 Lexicon pola i ies ................................... 91
43 P opo ions ...................................... 91
44 Da ase c ea ion p ocess ............................... 96
45 P ep ocessing pipeline ................................ 98
46 P ep ocessing asks .................................. 105
47 Co ela ions by au ho ................................. 108
48 Da ase ’s c ea ion pipeline .............................. 113
49 Lexicon expansion p ocess .............................. 114
50 P ep ocessing asks .................................. 115
51 Plu chik’s wheel o emo ions ............................. 122
52 P ep ocessing asks .................................. 124
53 Da ase c ea ed .................................... 125
54 Ou lie s iden i ica ion ................................. 126
55 Clus e s o in o ma ion ................................ 127
xi

Lis o Tables
1 Example o synse s .................................. 18
2 ANEW alues example ................................. 20
3 EmoLex lexicon .................................... 21
4 Dic iona y Lookup example .............................. 47
5 Co-occu ence ma ix ................................. 48
6 Le els o ela ionship ................................. 56
7 EmoLex lexicon snapsho ............................... 74
8 T aining da ase example ............................... 76
9 Pos s au ho s ..................................... 81
10 Pola i ies by au ho .................................. 84
11 Basic emo ions a e age pe au ho .......................... 85
12 Co ela ion be ween pola i ies and emo ions ...................... 85
13 De ailed accu acy esul s o non-p ep ocessed and p ep ocessed ex s ......... 86
14 Lexicon compa ison .................................. 90
15 Bill Ga es’ speech analysis .............................. 92
16 Donald T ump speech analysis ............................ 92
17 Co ela ions be ween
Amoun E o s
and emo ions ................... 99
18 Algo i hms co ela ions and hei Roo Mean Squa ed E o (RMSE) ........... 100
19 Ranges o
Amoun E o s
pe emo ions ......................... 101
20 Twee s au ho s .................................... 104
21 Pola i ies analysis om au ho s and hei op 5 audience ................ 106
22 Basic emo ions pe au ho .............................. 107
23 Basic emo ion’s equency a e age o audience’s au ho ................ 107
x
LIST OF TABLES
24 Co ela ion be ween basic emo ion’s au ho s and equency a e age basic emo ion’s op
audiences ...................................... 107
25 Co ela ion be ween basic emo ion’s au ho s ...................... 108
26 G amma ical s yle o au ho s and audiences ..................... 109
27 Co ela ion o g amma ical equency a e age be ween au ho s and audience . . . . . . 109
28 Simila i ies be ween au ho s and audiences ...................... 110
29 Cha ac e is ics o he pe sonal lexicon c ea ed ..................... 115
30 Algo i hms e alua ion ................................. 118
31 Emo ions in second ound’s day ............................ 118
32 Co ela ions be ween dep essi e s a us and basic emo ions .............. 125
33 Co ela ion be ween dep essi e s a us and in ensi ies ................. 126
34 Benchma k o Machine and Deep Lea ning algo i hms ................. 128
x i
1
In oduc ion
E e y day, a as numbe o people ake pho os, make ideos and send ex s using hei mobile equip-
men (sma phones, able s, e c.). Businesses a ound he wo ld collec da a on consume p e e ences,
pu chases and ends. Suppo ed by app op ia e egula ions, go e nmen s collec all so s o da a con-
ce ning a ic o e he in e ne o inciden epo s in police depa men s. This amoun o da a is g owing
as . Acco ding o [33], in 2020 o each minu e o he day, use s sha e 150000 messages in Facebook,
Amazon ships 6659 packages, Wha sApp use s sha e 41666667 messages and use s apply o 69444
jobs in LinkedIn. And his only a slice o he daily da a p oduc ion. The same company p edic ed in 2018
ha in 2020 e e y pe son on ea h will p oduce 1.7 Mb o da a each second [32].
This massi e amoun o da a is gene a ed om se e al sou ces (and no es ic ed o): a single pe son,
social g oups o companies. Fo ins ance, pe sonal sma wa ches can measu e and s o e he hea bea ;
sma phones can calcula e a elled dis ances, iPods can es ima e he numbe o calo ies bu ned du ing
he unning, websi es can s o e he use ’s na iga ion in o ma ion. Rega ding he da a gene a ed by a
pe son and among many o he so s, all ex s p oduced in he con ex o he so-called Compu e Media e
Communica ions—like blogs, commen s as eplies o Social Ne wo k pos s o Newspape a icles, cha s,
wee s , and so on — can con ibu e as a sou ce o in o ma ion cha ac e izing he au ho .
All his indi idual/pe sonal gene a ed da a, does no e eal, in a p ima y analysis, ele an in o ma ion.
Howe e , a e an in-dep h analysis, i can p o ide ele an knowledge abou he pe son in ol ed.
Using da a o in e in o ma ion abou use s is no new. Resea ching on cus ome buying beha iou
o e ime can e eal some unsuspec ed pa e ns – he mos amous example is he ela ion be ween
diape s and bee sold in la ge han usual quan i ies on F iday nigh s in a e aile . The hypo hesis was ha
husbands had o shop o diape s o he weekend while in hei way home om wo k - and while he e,
hey would pick up bee o he weekend spo s on TV. This ela ionship allowed he s o e o loca e diape s
and bee s close o each o he so ha mo e husbands migh be eminded o he one hey we e mos likely
o o ge .
In science a eas like psychology and medicine, he ex ual in o ma ion p oduced by a use can also be
an essen ial sou ce o iden i y pa e ns. Fo [62], exp essing emo ions can be done h ough w i ing, body
language, o alking wi h o he people. [48] link nega i e emo ions o inc eased s ess.
1
CHAPTER 1. INTRODUCTION
The au oma ic de ec ion o emo ions in ex s is becoming essen ial in many di e en a eas such as
educa ional/edu ainmen games o collec eedback om use s, inancial o p edic s ock ma ke p ices
and heal hca e o de ec he mood o pa ien s while in ea men . When handling wi h emo ions, he e is
common hinking ha exis s a s aigh connec ion be ween emo ions, mood and pe sonal p o ile, and i is
a hal - u h because mood exp esses emo ions. Howe e , he mood is di e en om he emo ional p o ile
(o pe sonali y) while he emo ional p o ile o a pe son s ays igid h oughou ou li e, he mood is mo e
open o change, in luenced by he cu en emo ions. In addi ion he emo ional s a e is a snapsho o he
mood in a speci ic momen , being he emo ional s a es’ collec ion along he ime simila o he emo ional
p o ile.
1.1 Mo i a ion
Emo ions a e p esen in mos o ou e e yday occasions and mani es a ions du ing ou li e, such as in
decision making and social ela ions. The esea ch con ibu ions in his a ea a e signi ican and can
p o ide heo e ical and p ac ical ad ances in human-machine in e ac ion, and a be e unde s anding o
he echnology in luence has on human de elopmen [155], allowing he compu e o adap o people
and no he opposi e. The s udy o he emo ions iden i ica ion in ex s is inse ed in a mul idisciplina y
con ex , going om Psychology, h ough he Mining o Tex s and Pa e n Recogni ion o Human-Compu e
In e ac ion. The esea ch a ea, known as Opinion Mining, has been expe iencing g ow h, wi h many
esea che s wo king in au oma ic opinion e alua ion on e-comme ce and Opinion po als.
The PhD wo k he e discussed aims a p esen ing a me hod o he iden i ica ion o he emo ional s a e
h ough he p ocessing o ex s w i en in English. The emo ions o be iden i ied in he ex s e e o he
emo ions p oposed in he Plu chik’s wheel o emo ions [157]. Neu al ex s (wi hou emo ion) a e also
iden i ied by he me hod. Fo he e alua ion o he p oposed me hod, will be cons uc ed a co pus o ex
messages o people demons a ing di e en le els o sen imen and a ool ha allows he conduc ion o
expe imen s wi h di e en con igu a ions.
The mo i a ion o his wo k is c ea ing so wa e ha analyses he con en o messages, ex ac ing he
emo ions con ained in o hese messages o in e he au ho ’s emo ional p o ile and - using his in o ma ion
- classi y he emo ional s a e ha he au ho p esen s a he w i ing ime.
This classi ie can be used in many di e en si ua ions (and no limi ed o hese ones): in a psy-
chological ea men scena io, whe e a pa ien needs o be assessed cons an ly; in he schola ly con ex ,
iden i ying cues abou bullying based on he s uden ’s emo ional p o ile changing; in he labou con ex ,
helping o iden i y he wo ke s unde isk o s ess.
Howe e , his ollow-up implies cons an da a collec ion, which can be conside ed somewha in asi e.
In imes when he limi s o p i acy and how a pe son’s da a a e ea ed a e discussed, i is necessa y ha
he people whose ex s a e unde analysis a e awa e and in ag eemen wi h his moni o ing.
2
1.2. OBJECTIVE AND RESEARCH QUESTIONS
1.2 Objec i e and Resea ch Ques ions
The objec i e o he doc o al p ojec he e discussed is o eso o echniques like ex mining and machine
lea ning o ex ac and classi y emo ional in o ma ion, om uns uc u ed documen s, in o de o iden i y
he sen imen con ained in he ex ha can be used o cha ac e ise he ex ’s au ho emo ional p o ile.
Thus, he esea ch ques ions ha will guide he execu ion o he wo k a e:
A. Do emo ional labels impac on he accu acy o classi ica ions o he emo ional s a es?
B. Is he e an abs ac model which di e en ia e he emo ions conside ing pe sonal pe spec i es ?
C. Based on he emo ional s a e o a pe son, would be possible o p edic his ac ions, choices o some
si ua ions which inspi e conce ning ?
To guide he answe s o hese ques ions, i we e o mula ed hese hypo hesis:
A. The cu en emo ional s a e o a pe son is exp essed in his ex s when w i ing;
B. The se o emo ions de ec ed in a la ge collec ion o ex s o an au ho du ing a la ge in e al
ep esen his emo ional p o ile;
C. The emo ional s a e can be classi ied acco ding o a ia ions wi h he emo ional p o ile.
The main con ibu ion o his p ojec will be an emo ional s a e classi ie h ough ex analysis, na u al
language p ocessing and machine lea ning algo i hms.
A a o mal desc ip ion le el, he p oposal is he c ea ion o an emo ional s a e classi ie ES:
𝐸𝑆 =𝑓(𝑇)(1.1)
whe e:
𝑇={𝑡𝑥𝑡1, 𝑡𝑥𝑡2, ..., 𝑡𝑥𝑡𝑛}is a se o ex s
and
𝑇𝑋𝑇 ={𝑤1,𝑤2, ...,𝑤𝑛}is a se o wo ds, whe e 𝑤can con ain emo ional in o ma ion.
1.3 Documen S uc u e
This hesis is o ganized in 4 pa s and begins wi h an in oduc ion o he con ex , mo i a ion and objec i es
in Chap e 1.
Pa Iincludes Chap e s 5 o 2and p esen s he S a e o he a .
Pa II jus includes one chap e in ended o p esen he PhD p oposal.
Pa III includes Chap e s 7 o 12, aiming a p esen ing and discussing he case s udies o which he
p oposed emo ional classi ie was applied.
3

CHAPTER 1. INTRODUCTION
Pa IV p esen s a summa y p esen ed and some conclusions as well as and some di ec ions o u u e
wo k a e p esen ed.
4
Pa I
S a e o he A
5
This pa in oduces he s a e o a o he heo ies and echnologies ha we e used du ing he wo k.
Fi s , i is p esen ed abs ac concep s and heo ies om psychology, such as emo ions and he di e en
models o ep esen hem, he human pe sonali y and he pe sonal ocabula y as sou ce o pe sonali y
di e en ia ion.
La e , he a se o echniques om Na u al Language P ocessing a e p esen ed, in o de o explain how
he in o ma ion can be e ie ed om ex s and modelled o ep esen he abs ac concep s p esen ed
ea lie .
2
Emo ions
Al hough emo ions ha e been s udied in se e al a eas o knowledge such as Psychology, Neu oscience,
Philosophy and A i icial In elligence, he e is no consensus on he de ini ion o emo ion because some
issues such as i s subjec i e na u e, he di e gence o esea che s as o i s o igin, and he e m used o
desc ibe a wide ange o cogni i e and physiological s a es [57]. This lack o consensus ein o ces he
idea o [47] which claimed ha “e e yone knows wha emo ion is un il asked o gi e a de ini ion. Then, i
seems no one knows.”
Fo [96], he concep o emo ion can a y among se e al de ini ions, depending on he a ea o knowl-
edge om which hey a ise. In he psychological and beha iou al a ea, emo ions can be unde s ood as
sys emic esponses ha occu when highly mo i a ed ac ions a e delayed o inhibi ed. Thus, emo ions
conce n he execu ion o some hing ele an o he o ganism.
[29] highligh ed he undamen al ole o emo ions in he p ocess o adap a ion o li ing beings. Acco d-
ing o he au ho , a acial exp ession indica ing emo ional s a es is a o m o communica ion ha is e icien
and unde s andable o people, ega dless o cul u e, and hese s iking cha ac e is ics a e adap i e in all
li e o ms.
In cogni i e sciences, acco ding o [28], emo ions a e body mo emen s o ac ions isible o hi d
pa ies. On he o he hand, he sen imen s a e hidden in he o ganism whe e hey occu , in isible o he
public. Sen imen s can a ise by me ely hinking abou an e en , and imagining wha would happen i i
would occu .
The di e en ia ion p esen ed abo e allows no icing ha emo ions in cogni ion ha e a much mo e
isible, as well as conscious, ole in he day- o-day. Fo example, he mood is widely used in educa ional
se ings as a way o mo i a ing a en ion, de eloping a ec i e sen imen s owa ds he augh con en , and
p omo ing a mo e enjoyable lea ning expe ience [140].
Di e en scien i ic heo ies o emo ion ha e been c ea ed o e he yea s o esea ch in cogni i e sci-
ences, each ying o explain he di e si y o a ec phenomena. These heo ies ga e ise o h ee main
models o emo ions: disc e e models, also called ca ego ical ones; dimensional models; and models
based on app aisal heo y (cogni i e models).
7
CHAPTER 2. EMOTIONS
2.4 A ec i e Compu ing
The concep o A ec i e Compu ing (AC) was in oduced by [155], who de ined “ he compu ing ha ela es
o, a ises om o delibe a ely in luences emo ions.” The a ec i e compu ing ocus is on es ablishing
models, based on physiological and beha iou al signals collec ed by senso s and echniques o pe cei e,
ecognise and unde s and human emo ions o p o ide be e eedback. Emo ion iden i ica ion is used
in he ield o cogni i e science [144] ha ing a connec ion o a ec i e compu ing enabling compu e s o
ecognise emo ions [155].
Acco ding o [69], he a ising o AC is ela ed o he needs o pu compu e s in e ac ing di ec ly, hinking,
ecei ing and ansmi ing people’s pe sonali ies. [155] and [69] emphasise AC as a esea ch a ea which
examines how compu a ional sys ems can iden i y, classi y, and p o e human pe sonali y as well as g oup
knowledge in o he a eas, such as psychology and cogni i e science.
To achie e his objec i e, AC in compu e in es iga es how compu e s could model, ecognise, and
espond o human beha iou s, and hus how o exp ess h ough an in e ace compu a ional in e ac ion.
The pu pose o p omo ing his cha ac e isa ion is o con ibu e o inc ease he consis ency, cohe ence and
c edibili y o he eac ions and compu a ional esponses p o ided du ing human in e ac ion ia human-
compu e in e ace [155].
To imp o e s udies, [164] analysed he beha iou o people h ough compu a ional agen s, using he
models o psychologis s such as [144], [178] and [167], con aining emo ional cha ac e is ics. These
cha ac e is ics ha e con ibu ed o he consis ency, cohe ence, and p edic ion o emo ional esponse in
compu e esponses.
Fo [137], a e [155] he esea ch on pe o ming he analysis o emo ions compu a ionally inc eased
signi ican ly, e en mo e when a g ea a ie y o en i onmen s o in e ac ion be ween humans and compu -
e s a ose, such as social media, cha bo s, among o he s.
[105] de ines Sen imen Analysis (SA) which is embedded in he A ec i e Compu ing as he a ea ha
analyses he opinions, eelings, e alua ions, a i udes and emo ions o he people exp essed in w i en ex .
Unde he SA concep , i is possible o ind also many di e en names and asks, such as Opinion Mining,
Opinion Analysis, Opinion Ex ac ion, Sen imen Mining, Subjec i i y Analysis, A ec Analysis, Emo ion
Analysis and Re iew Mining. In indus y, he e m Sen imen Analysis is mos commonly used, and in
academic esea ch bo h Sen imen Analysis and Opinion Mining a e o en employed. Rega dless, hey
ep esen , basically, he same ield o s udy. The e m Sen imen Analysis appea ed o he i s ime in
[138], as he e m Opinion Mining was in oduced by [30].
2.5 De ec ing Emo ions Challenges
Fo he i e human senses (sigh , smell, ouch, as e and hea ing), wo o hem - sigh and hea ing - a e
esponsible o ansmi he emo ions among pe sons. This ansmission uses en i onmen s such as ex s,
14

2.5. DETECTING EMOTIONS CHALLENGES
speeches and images, and acco ding o he en i onmen used, di e en echniques mus be applied o
de ec hese emo ions.
2.5.1 De ec ing Emo ions in Tex s
Lexicon-based and Machine Lea ning (ML) app oaches a e commonly used o sol e SA p oblems in ex s.
Figu e 6shows he wo main app oaches and how hey a e subdi ided.
Figu e 6: App oaches o Sen imen Analysis in ex . Sou ce: au ho
I is usual o ind in he li e a u e hyb id wo ks ha use bo h app oaches o iden i y emo ions in ex s.
[59] p esen s a wo k which uses lexicon and ML o iden i y he six basic emo ions. [163] use a lexicon o
help in he selec ion o ea u es and ML algo i hms o iden i y he six basic emo ions in Spanish ex s.
The ML-based app oach is di ided in o supe ised ML and unsupe ised AM. Supe ised me hods
equi e a la ge numbe o labelled ex s o pe o m he aining. Unsupe ised me hods a e an op ion
when he e is di icul y in ob aining labelled ex . The main algo i hms based on supe ised ML ha a e
mos commonly used in he classi ica ion o emo ions in ex s a e p esen ed in Sec ion 2.5.1.2.
The lexical app oach depends on he a ailabili y o an emo ional e ms lexicon. This app oach is sub-
di ided in o wo o he app oaches: dic iona y-based and co pus-based. In he dic iona y-based app oach,
ini ially, a small se o emo ional e ms is collec ed manually whe e each e m has i s associa ed emo ion.
This se o wo ds, called seeds, is used o sea ch in dic iona ies such as Wo dNe A ec [188] o Sen i-
Wo dNe [43] o explo e seman ic links, synonyms and an onyms and newly disco e ed e ms a e added
o he seed lis . The i e a i e p ocess ends when no new e ms a e ound [103].
In he co pus-based app oach, he e is also a lis o emo ional e ms used o ind o he emo ional
e ms in a la ge domain co pus. The objec i e is o aid in emo ional e ms sea ches wi h speci ic con ex
guidelines. This can be done using s a is ical o seman ic me hods [103].
15
CHAPTER 2. EMOTIONS
2.5.1.1 Lexicon-based app oaches
Fo [66], in NLP-con ex , lexicons a e componen o a sys em ha con ains in o ma ion (seman ic and/o
g amma ical) abou wo ds o exp essions, whe eas he e m dic iona y usually e e s o objec s (p in ed
books o elec onic) in ended o human eade s, bu also accessible by compu e s.
Fo [6] a lexicon is de i ed om he examina ion o a co pus, which in u n is de ined in he Ox o d
English dic iona y as an “o gan, collec ion o w i ings.”The e is no minimum o maximum size o co po a,
o any speci ica ion wha i should con ain.
The manual cons uc ion o a lexicon is an a duous ask due o he la ge olume o in o ma ion and
he amoun o ime ha is spen o ca y ou he s eps. Fo his ask, he e a e e o s in he c ea ion o
lexicons h ough compu a ional echniques, o example, as p esen ed by [149]. Ano he me hod o he
cons uc ion o compu a ional lexicons is he analysis and imp o emen o exis ing lexicons.
The ini ial poin o any app oach o s udy emo ion in a ex is he use o speci ic a ec i e lexicons.[23]
a e one o he i s esea che s a ge ing he p oblem o he e e en ial s uc u e o he a ec i e lexicon.
A ec i e lexicons a e subse s o lexicons which a e cons uc ed based on di e en me hodologies and
p o ide bases o mos machine lea ning algo i hms. In ou comp ehension, hese subse s a e esponsible
o ca ying emo ional labels o he wo ds. This ision is sha ed by Mohammad [134], ha de ines an
a ec i e lexicon as “a lis o emo ions and wo ds ha a e indica i e o each emo ion.”
[145] a gue ha a ec i e lexicons do no only con ain e ms ela ed o emo ion bu ha e o he e ms
and a ec i e condi ions (a ec ion, mood and sen imen ). Te ms such as “a ec ion”and “emo ion”a e
used, some imes as synonyms. The dis inc ion occu s when he e m a ec ion e e s o any hing whose
alence alue is posi i e o nega i e. A ec ion has a b oade ca ego y when compa ed o emo ion. Types
o a ec i e condi ion cause emo ions, bu no all a ec i e condi ions a e emo ions.
A he beginning o s udies in a ec i e lexicons, [8] analysed he da a selec ed and conside ed ha ing
a ec i e conno a ions om [4]. The objec i e was o de elop a me hod, called “seman ics”, which would
map a uni e se o wo ds wi h a ec i e cha ac e is ics. Howe e , we e no all wo ds included in he analysis
ha had a ec i i y, which “jus i y ha any di ision be ween a ec i e concep s is necessa ily ague and
a bi a y”[8].
The e is no p e-de ined model o he cons uc ion o an a ec i e lexicon. Mos o he wo ks ha e
c ea ed de ined s eps and goals om s udies o achie e he goal. O he wo ks ake lexicons al eady
de eloped and implemen ed and make imp o emen s and ex ensions. The ollowing is a desc ip ion o
some mo e impo an lexicons and a ec i e lexicons a ailable:
Wo dNe Wo dNe 1is an ex ensi e English-language lexical da abase de eloped by Geo ge A. Mille ,
combining lexicog aphical in o ma ion (lexical and seman ic ela ions used o ep esen he lexical knowl-
edge o ganisa ion) and compu a ional esou ces [51]. [131] de ines he ocabula y o a language wi h a
se
W
wi h pai s (
,
s
), whe e a o m
is a cha ac e s ing o e a ini e alphabe and
s
is a sense om a
1h p://wo dne .p ince on.edu
16
2.5. DETECTING EMOTIONS CHALLENGES
se o meanings. Each o m wi h a sense in a language is called a wo d in ha language. In Wo dNe , a
sense is ep esen ed by a se o one o mo e synonyms. The base has mo e han 118,000 di e en wo ds
and mo e han 90,000 wo ds [131].
Wo dNe is composed o nouns, e bs, adjec i es and ad e bs g ouped in o se s o synonyms (synse s),
each exp essing a dis inc concep . These a e o ganised in o a se o lexicog aphe s by syn ac ic ca ego y
and by o he o ganisa ional c i e ia. Ad e bs a e kep in only one ile, while nouns and e bs a e g ouped
acco ding o seman ics. Adjec i es a e di ided in o desc ip i e and ela ional adjec i es [130].
Figu e 7: Wo dNe online sea ch
Figu e 7illus a es he esul o an online Wo dNe que y o he wo d
expensi e
. In he igu e, i
is possible o isualise he lexical ela ionship o he wo d expensi e. In
simila o
, he e is he e m
o e p iced
, which has he same synse and
an onym
co esponds o he opposi e o he sea ched wo d.
The wo d
expensi e
, in he example, has only one sense in Wo dNe .
Wo dNe A ec Wo dNe -A ec [188] is an ex ension o he Wo dNe da abase [129], which includes
a subse o synse s sui able o ep esen a ec i e concep s. In pa icula , i allows Wo dNe synse o be
assigned wi h one o mo e a ec i e labels (a-labels). The e a e also a-labels o concep s ep esen ing
moods, si ua ions elici ing emo ions, o emo ional esponses. Table 1show some example o synse s.
I was ex ended wi h a se o addi ional a-labels (called emo ional ca ego ies), hie a chically o ganised
o specialise synse s wi h a-label emo ion acco ding o emo ional alence: posi i e, nega i e, ambiguous,
and neu al.
The posi i e alence co esponds o posi i e emo ions, de ined as emo ional s a es cha ac e ised by
he p esence o posi i e hedonic signals. I includes synse s such as joy#1 o en husiasm#1. Simila ly,
he nega i e a-label iden i ies nega i e emo ions cha ac e ised by nega i e hedonic signals, o example,
ange #1 o sadness#1. Synse s ep esen ing a ec i e s a es whose alence depends on seman ic con ex
(e.g. su p ise#1) we e ma ked wi h he ag ambiguous. Finally, synse s e e ing o men al s a es ha a e
conside ed a ec i e bu a e no cha ac e ised by alence we e ma ked wi h he ag neu al.
Ano he aluable p ope y o a ec i e lexicon is he s a i e/causa i e dimension. An emo ional ad-
jec i e is conside ed causa i e i i e e s o some emo ion ha is caused by he en i y ep esen ed by he
17
CHAPTER 2. EMOTIONS
Table 1: Example o synse s
A-label Example o synse s
EMOTION noun ’ange ’, e b ’ ea ’
MOOD noun ’animosi y’, adjec i e ’ ea ’
TRAIT noun ’agg essi eness’, adjec i e ’compe i i e’
COGNITIVE s a e noun ’con usion’, adjec i e ’dazed’
PHYSICAL s a e noun ’illness’
HEDONIC signal noun ’hu ’, noun ’su e ing’
Emo ion-elici ing SITUATION noun ’awkwa dness’
Emo ional RESPONSE noun ’cold swea ’, e b ’ emble’
BEHAVIOUR noun ’o ence’, adjec i e ’inhibi ed’
ATTITUDE noun ’in ole ance’, noun ’de ensi e’
SENSATION noun ’coldness’, noun ’ eel’
modi ied noun (e.g. annoying mo ie). In he same way, an emo ional adjec i e is said s a i e i i e e s o
he emo ion owned o el by he subjec deno ed by he modi ied noun (e.g. chee ul/happy boy).
Sen iWo dNe Sen iWo dNe (SWN) is ano he lexicon, de eloped by [43] explici ly o collabo a e on
applica ions o Da a Mining and Opinion Classi ica ion. This lexical esou ce is he esul o au oma ed
no a ions in all synse s o Wo dNe 3.0, wi h a deg ee o posi i i y, nega i i y and neu ali y. Each synse
is associa ed wi h h ee nume ic alues, Pos(s), Neg(s) and Obj(s) ha indica e how posi i e, nega i e, o
objec i e (neu al) he e m con ained in he synse is. Each o he h ee alues a ies in he ange [0.0,
1.0] and hei sum is 1.0 o each synse , so Obj (s) + Pos (s) + Neg (s) = 1.
Figu e 8illus a es he g aphical ep esen a ion adop ed by SWN Rep esen ing p ope ies ela ed o
synse . The edges o he iangle ep esen one o h ee classi ica ions (posi i e, nega i e and objec i e)
and a poin e (Synse posi ion) poin s o he highes alue classi ica ion.
Figu e 8: Sen iWo dNe Synse ’s p ope ies. Adap ed om h ps://on o ex . bk.eu/sen iwn.
h ml
The me hod used o de elop SWN is de i ed om he wo k o [44,45], based on he quan i a i e
18
2.5. DETECTING EMOTIONS CHALLENGES
analysis o e ms associa ed o synse s and on he use o ec o ep esen a ion o esul ing e ms o semi-
supe ised classi ica ion o synse s. The sco ing io in he SWN is de i ed om he esul s combina ion
p oduced by a commi ee o eigh e na y classi ie s, wi h simila le els o p ecision, bu wi h di e en
classi ica ion composi ion. Each subjec classi ie di e s om he aining se and he lea ning adop ed
o his se , hus p oducing dis inc classi ica ions esul ing om each Wo dNe synse .
The SWN sco e is gi en by he a io o classi ie s assigned he co esponding label o he synse . I all
e na y classi ie s esul in assigning he same label o a synse , he labelling will ha e he highes sco e
o he synse bu will ha e a sco e p opo ional o he numbe o classi ie s ha assigned i [9,43].
The SWN da a lexicon is also a ailable as a da a ile (. x ). The Figu e 9show some examples o he
eco ds in Sen iWo dNe 3.0:
Figu e 9: Sen iWo dNe eco ds
The POS-ID iden i ies he synse ,
PosSco e
and
NegSco e
alues co espond o posi i i y and nega i i y
poin ed ou by SWN o he de ined synse . The alue o objec i i y is gi en by: Obj(s) = 1 - (Pos(s) +
Neg(s)). The
SynseTe ms
column co esponds o he spaced e ms in he synse , wi h he g amma class
and numbe co esponding o he sense. The Gloss column desc ibes he meaning o he e m.
Sen iS eng h Sen iS eng h is a lexicon c ea ed by [192] aimed o iden i y sen imen in sho ex s,
con aining 2310 sen imen wo ds and wo d s ems ob ained om he LIWC, he Gene al Inqui e lis o
sen imen e ms [186] and some ad-hoc addi ions.
I uses a Kleene S a implemen a ion o iden i y he lexicon wi h a wildca d a he end o a wo d. Fo
ins ance, “amaz*”ma ches all wo ds s a ing wi h “amaz”, such as amazed and amazing.
Fo each oken o s em in a ex , Sen iS eng h e u ns a posi i e and nega i e sco e, anging om 1
o 5 and -1 o -5 espec i ely. Ma ching his, each oken o s em in he dic iona y ecei es a posi i e o
nega i e sco e wi hin one o hese wo anges.
Using he ool, he sen ence “I eally like you bu dislike you cold sis e ”has as esul s:
I eally lo e [3] [+1 boos e wo d]
you bu dislike [-3]
you cold [-2] sis e
19

CHAPTER 2. EMOTIONS
So, he inal esul s sco e 4 - s ong posi i e sen imen , and sco e -5 - s ong nega i e sen imen .
All wo ds in lexicon ha e hei s sco es p e iously classi ied, analysed and e alua ed, and he inal sco e
sen ence is a sum o he indi idual wo ds’ sco es o each pola i y. The wo ds ha appea in he ex ,
and a e no con ained in he lexicon, a e no analysed and consequen ly do no in e e e wi h he inal
classi ica ion.
Fo a lexicon sen imen weigh sco es ine- une, Sen iS eng h uses a machine lea ning app oach
implemen ing a speci ic and p op ie a y algo i hm. The eason o his kind o inpu o he sen imen
weigh s is ha he low equency o many e ms in ex s would con ibu e o a w ong machine lea ning
weigh s assignmen .
ANEW
Ame ican No ms o English Wo ds
, o ANEW [14], is a se o 1034 wo ds which measu es
h ee emo ional dimensions: alence, ale ness and dominance. The alence consis s in how pleasan
o unpleasan a s imulus is pe cei ed. The second dimension, ale ness, consis s o how s imula ed o
elaxed a s imulus makes us. The hi d dimension, dominance, consis s in how much in con ol o a
s imulus o domina ed by i is pe cei ed.
The alue o each wo d in each dimension was ob ained om a ings made on a scale o 1 o 9, made
by unde g adua e s uden s, whe e a a ing o 1 deno ed highly nega i e and 9 deno ed highly posi i e. Table
2demons a es an example o how he ANEW alues a e s o ed.
Table 2: ANEW alues example
Desc ip ion Valence Mean (SD) A ousal Mean (SD) Dominance Mean (SD)
abduc ion 2.33 (2.13) 6.09 (2.72) 2.76 (2.49)
abo ion 3.15 (2.39) 5.85 (3.09) 4.00 (2.55)
absu d 4.70 (1.30) 4.65 (1.93) 4.70 (1.42)
abundance 6.55 (1.90) 5.10 (2.53) 5.55 (2.11)
abuse 1.46 (1.03) 6.88 (2.83) 3.81 (3.12)
accep ance 8.18 (1.56) 4.86 (3.00) 6.55 (1.99)
acciden 2.08 (1.29) 6.48 (2.62) 3.92 (2.29)
ace 6.14 (2.10) 4.95 (2.33) 6.33 (2.08)
EmoLex The EmoLex Wo d-Emo ion Associa ion Lexicon (EmoLex) is a lexicon c ea ed by [134] com-
posed o a lis o mo e han 14000 English wo ds and hei associa ions wi h eigh basic emo ions (ange ,
ea , an icipa ion, us , su p ise, sadness, joy, and disgus ) and wo sen imen s (nega i e and posi i e).
The anno a ions we e collec ed using a c owdsou cing Mechanic Tu k, and di e en han he o he
lexicons, EmoLex shows associa ion sco es o he emo ions and sen imen s as 0 (no associa ed) and 1
(associa ed). An example as EmoLex is composed is p esen ed in Table 3.
20
2.5. DETECTING EMOTIONS CHALLENGES
Table 3: EmoLex lexicon
Wo d Posi i e Nega i e Ange An icipa ion Disgus Fea Joy Sadness Su p ise T us
aback 0 0 0 0 0 0 0 0 0 0
abacus 0 0 0 0 0 0 0 0 0 1
abandon 0 1 0 0 0 1 0 1 0 0
abandoned 0 1 1 0 0 1 0 1 0 0
abandonmen 0 1 1 0 0 1 0 1 1 0
aba e 0 0 0 0 0 0 0 0 0 0
aba emen 0 0 0 0 0 0 0 0 0 0
abba 1 0 0 0 0 0 0 0 0 0
abbo 0 0 0 0 0 0 0 0 0 1
2.5.1.2 Machine Lea ning algo i hms o sen imen ex ac ion
In Machine Lea ning li e a u e, he e a e se e al algo i hms de eloped o deal o di e en si ua ions, each
one ha ing hei p os and cons. Below a e p esen ed he mos used algo i hms o handle wi h sen imen
analysis:
Nai e Bayes The Nai e Bayes classi ie is widely used in classi ying ex s because o i s compu a ional
e iciency and good p edic i e pe o mance.
The Nai e Bayes classi ie has he “nai e”because i assumes ha he p obabili ies a e combined
independen ly o each o he , ha is, he p obabili y ha a e m in he documen is in a speci ic ca ego y
is no ela ed o he likelihood o o he e ms being in his ca ego y [181].
Bayesian classi ie s use Bayes’ Theo em o classi y da a. I X is he se o cha ac e is ics and Y is he
class a iable, i is possible o de e mine hei ela ionship using p obabilis ically:
𝑃(𝑌|𝑋)=𝑃(𝑋|𝑌).𝑃 (𝑌)
𝑃(𝑋)
Acco ding o [151], o pe o m ex classi ica ion is needed o assign a class c o a documen d.
𝑃(𝑐|𝑑)=𝑃(𝑑|𝑐).𝑃 (𝑐)
𝑃(𝑑)
Since
P(d)
does no dis u b in he selec ion o c and o calcula e
P(d
|
c)
, is conside ed ha he p oba-
bili ies o each cha ac e is ic a e independen o he class.
Al hough he hypo hesis o independence is necessa y o he algo i hm o mula ion, Nai e Bayes
wo ks app op ia ely in se e al applica ions which such hypo hesis canno be e i ied, ha ing success in
pa o he consequence o he e sa ili y. As he hypo hesis o independence loses powe in a gi en model,
he adjus men o he assumed dis ibu ion wo sens. Howe e , i bo h es ima ed and eal dis ibu ions
ag ee on he mos likely class, he classi ie will s ill pe o m well [165].
21
CHAPTER 2. EMOTIONS
Suppo Vec o Machines The classi ica ion ask in ol es a se o aining da a. Each ins ance o he
aining se con ains a “ a ge alue” ha e e s o he class o label. The objec i e o he Suppo Vec o
Machines (SVM) is o p oduce a model, based on he aining da a, which p edic s he a ge alues (class)
o he new da a [74].
The main idea o SVM-based classi ie s is o cons uc an op imal hype plane so ha i can sepa a e
di e en classes o da a wi h as much ma gin as possible. The SVM hype planes a e de e mined by a
ela i ely small subse o aining examples, which a e called suppo ec o s. Figu e 10 illus a es an
op imal hype plane o a se o linea ly sepa able da a.
Figu e 10: Suppo Vec o and Ma gin iden i ica ion. Adap ed om h ps://medium.com/
mlea ning-ai/suppo - ec o -machine-s m-algo i hm-a5acaa48 e3a
Ano he ele an ea u e o SVM is he abili y o classi y da a se s wi h complex scopes, as in Figu e
11. Fo his, mapping he p oblem o a di e en space allows a hype plane o pe o m class sepa a ion
(Figu e 12). To he ans o ma ion be simpli ied and compu a ionally less cos ly, he “ke nel ick”[73] is
pe o med, wi h he use ha ing o choose some ans o ma ion ke nel unc ions.
Figu e 11: Non-linea ly sepa able da a. Sou ce: au ho
The SVM classi ie p esen s an in insic limi a ion: he bina y segmen a ion. I is no possible, h ough
he usual me hodology, o classi y mo e han wo ypes o elemen s in o a he e ogeneous se . To sol e
his p oblem, he solu ion is successi e cascade classi ica ions.
22
2.5. DETECTING EMOTIONS CHALLENGES
Figu e 12: Non-linea ly sepa able da a. Sou ce: au ho
In his app oach, known as “SVM mul iclass”, he elemen s o be classi ied can be, a each i e a ion
o he SVM, emo ed one by one om he o iginal g oup, as shown in Figu e 13. In his one-on-one
con on a ion p ocess, he SVM lis s a sui able ma ch o each i e a ion, yielding he inal one, a esul ha
is quali a i ely simila o o he mul iclass classi ie s.
Figu e 13: SVM Mul iclass classi ica ion p ocess. Sou ce: au ho
Maximum En opy Model A maximum en opy model classi ie is a p obabilis ic model ha a ou s
classes dis ibu ion mo e uni o m which adhe e o a speci ic se o cons ain s de e mined by aining da a.
[27] in oduce an example in ex ca ego iza ion domain. Gi en a documen 𝑑con aining h ee classes 𝑐1,
𝑐2,𝑐3, i no in o ma ion is known abou he documen om he aining da a, i is possible o claim ha he
p obabili y o classi ying 𝑑in each o he classes is equal, ha is, 1/3. Howe e i i has “lea ned” om he
aining da a ha 2/3 o he documen s con aining he wo d “spo s”belong o class 𝑐1and he documen
𝑑con ains he wo d “spo s”, i is possible o claim ha he documen 𝑑classi ica ion p obabili y o class
𝑐1is 2/3 and he o classes 𝑐2and 𝑐3is equal o 1/3 each. The sample da a p o ide such cha ac e is ics
and hey will be used o de e mine he cons ain s.
23
CHAPTER 3. HUMAN BEHAVIOUR
ai iden i ied in he se o all use ’s e iews. Fo he ecommenda ion, he a e age o each pe sonali y
ai o all games’ e iews was calcula ed o each game. Finally, he bes game ecommenda ions we e
anked by a cosine dis ance om he use ’s pe sonali y ai s.
O he app oach using NLP o iden i y pe sonali y was p esen ed by [174], whe e ex s we e ga he ed
om Facebook pos s in B azilian Po uguese and he ex s au ho ’s pe sonali y was iden i ied based on Big
Fi e’s ai s. Using p ep ocessing s eps, he ex s we e ep esen ed in ec o s, con aining he equency o
he wo ds in each Big Fi e’s ai , acco ding o LIWC. These ec o s ed a Mul iLaye Pe cep on classi ie o
e alua e he esul s, and hese esul s a e compa ed o a p e ious pe o med analysis, in o de o e alua e
he algo i hm.
3.2 Pe sonal lexicon
I is known ha o all languages he e is a as se o wo ds - he lexicon - which people can explo e and
en ich dialogue in a a ie y o ways. Howe e , when people alk, hey use a “pe sonal lexicon”, which
is exac ly he wo ds ha wi hin hei language, a e chosen by he pe son who is exp essing hemsel es.
Wi hin he ocabula y, he e a e synonyms, which a e di e en wo ds, bu which ha e he same meaning.
In some cases, he e a e dozens o di e en wo ds, bu wi h he same meaning. The main ques ion is
ha o some eason, some people p e e o use some wo ds o o he s, and wha d i es hese people
o make ha choice decision? Which leads hem o choose he wo d “in e es ing” ins ead o “cool”, o
example. Why when someone who is going o a el o a small ci y p e e s o say ha i is “quie ” o
“com o able” e en “di ine place”. I depends on each pe son and ha in some cases, some wo ds
emind us o someone, due o he numbe o imes ha pe son uses ha wo d.
I is in e es ing o no e how di e en pe sonal ocabula y is ela ed o people, as he e a e p e e ences
in choosing wo ds in dialogue. In a con e sa ion, each wo d is impo an , so ha all he wo ds spoken a e
no in ain, ha e g ea alue. They a e p onounced p ecisely because hey a e he bes , he mos pleasan
o he bes way o a pe son o exp ess hemsel es. This is like a inge p in , whe e he equency o using
hose wo ds says a lo abou he pe sonali y o he use .
This pe sonal lexicon is impo an because i helps o di e en ia e indi iduals acco ding o he e-
quency o use o wo ds. Howe e , his is no he only in o ma ion ha can be ex ac ed om a pe sonal
lexicon. In gene al, h ough he use o wo ds, i is possible o iden i y a pe son’s o igin, gende o e en
whe e a con e sa ion occu ed. In Po uguese, he wo d “
ob igada
” ( hanks) is used only he au ho is
emale. I he au ho is male, he wo d mus be “
ob igado
” ( hanks).
Mo eo e , acco ding o he con ex (coun y, place, company, e c) whe e a con e sa ion occu s, i is
possible o iden i y di e ences in he in e p e a ion o he wo ds used, ha is alid only in his con ex , as
p esen ed by [120]. This is he egionalism.
Se e al examples exhibi his si ua ion: he wo d “
a o
” in B azilian Po uguese e e s o he wo d “ ac ”
while in Po uguese spoken in Po ugal, “
a o
” means “coa ”. The Spanish wo d “
in o
” in Colombia is
30

3.3. SUMMARY
abou “co ee” whe e in Spain, he wo d is ega ding o “ ed wine”.
Due o hese di e ences, in ex in e p e a ion in NLP, i is no secu e (and ce ainly impossible) o
ha e an uni e sal lexicon o consul all wo ds, leading o he isk o misunde s anding. To o e come his
issue, a use ul app oach is pe o m a lexicon expansion.
3.3 Summa y
In his chap e we p esen ed he concep s o pe sonali y and pe sonal lexicon. Acco ding o he pe sonali y
o he pe son, his ocabula y can a y when compa ing o he ocabula y o o he pe son. A calm pe son
ce ainly use calm wo d mo e equen ly when compa ed o an anxious pe son. Fo his eason i is
impo an no o gene alize he ocabula y o all pe son, i.e. ha ing a pe sonal ocabula y o each
pe son, ep esen ing hei basic pe sonali y’s b icks.
In his wo k will be used a pe sonal (expanded) ep esen a ion o an emo ional lexicon, in o de o
indi idualize he emo ions applied in o he sen ences.
31
4
Tex Mining and NLP
Tex mining, also e e ed as ex da a mining o knowledge disco e y [46], is an a ea o compu e science
esea ch which e e s o he p ocess o ex ac ing ele an in o ma ion om uns uc u ed ex documen s
using echniques om da a mining, na u al language p ocessing, machine lea ning, knowledge manage-
men and in o ma ion e ie al.
I can be de ined as a p ocess o seek and ex ac use ul in o ma ion om uns uc u ed da a sou ces
such as e-mails, HTML iles, e c. h ough he iden i ica ion and explo a ion o in e es ing pa e ns [50].
Figu e 14 gi es he o e iew o ex mining p ocess.
Figu e 14: Tex Mining o e iew. Sou ce: au ho
These da a sou ces a e documen collec ions, and he equen ly in e es ing in o ma ion pa e ns a e
ound in he uns uc u ed ex ual da a. So, i is a s aigh deduc ion ha ex mining and da a mining
ha e simila i ies. Fo ins ance, bo h sys ems ha e ea u es as p e-p ocessing ou ines, pa e n-disco e y
algo i hms, and p esen a ion-laye elemen s, howe e , while ex mining wo ks on uns uc u ed da a, da a
mining wo ks on da a wi h known and ixed s uc u e.
32
4.1. APPLICATIONS OF TEXT MINING
4.1 Applica ions o Tex Mining
While much o he p e-p ocessing asks in da a mining ocus in da a cleaning, no malizing and c ea ing
ex ensi e numbe s o able joins in a s uc u ed da abase, in he con ex o ex mining sys ems, p e-
p ocessing ope a ions ocus in pa e n iden i ica ion and ex ac ion o ep esen a i e ea u es o na u al
language documen s. These p e-p ocessing ope a ions ans o m he uns uc u ed da a con ained in he
documen s in o a s uc u ed in e media e ep esen a ion o he o iginal documen [95]. So, applica ion
o Tex Mining can en ich some esea ch a eas, such as
In o ma ion Re ie al, In o ma ion Ex ac ion,
Ca ego iza ion and Na u al Language P ocessing
.
4.1.1 In o ma ion Re ie al
Acco ding o [114] in o ma ion e ie al (IR) “is inding ma e ial (usually documen s) o an uns uc u ed
na u e (usually ex ) ha sa is ies an in o ma ion need om wi hin la ge collec ions (usually s o ed on
compu e s).”
In o he wo ds, an IR model selec s o anks he se o documen s ega ding o an use que y. Bo h
esul ex in documen s and que ies can be o malized by a unc ion ha e u ns a Re ie al S a us Value
(RSV) o each documen o he collec ion. Mos IR sys ems ep esen documen con en s by a se o
desc ip o s, called e ms, belonging o a ocabula y V.
Acco ding o [106], main IR models de ine he que y-documen ma ching a unc ion ha weigh s he
que y e ms occu ing in a documen acco ding o ou main app oaches:
• The es ima ion o he p obabili y o use ’s ele ance 𝑟𝑒𝑙 o each documen 𝑑and que y 𝑞conce n-
ing a se 𝑅𝑞o aining documen s 𝑃𝑟𝑜𝑏(𝑟𝑒𝑙 |𝑑,𝑞, 𝑅𝑞);
• The compu a ion o a simila i y unc ion be ween que ies and documen s in a ec o space𝑆𝐼𝑀(𝑑, 𝑞);
• The es ima ion o he p obabili y o e ie ing he documen 𝑑gi en a que y 𝑞,𝑝(𝑑|𝑞);
• The in o ma ion ca ied by he que y e ms in he documen , ha is he numbe o bi s necessa y
o code 𝑋𝑖occu ences o he que y e ms 𝑡𝑖∈q in he documen : −𝑙𝑜𝑔2𝑃𝑟𝑜𝑏(𝑑|𝑋1, ..., 𝑋𝑞).
An in o ma ion e ie al sys em is no a da abase sys em. Despi e o ha ing close unc ionali ies,
mainly he abili y o look o answe s o he use gi en que ies sea ching in la ge in o ma ion s o es, he e
a e signi ican di e ences be ween hem, such as:
• Da abase sys ems
Concu ency con ol;
Reco e y;
T ansac ion managemen ;
Upda e;
33
CHAPTER 4. TEXT MINING AND NLP
• In o ma ion e ie al
Uns uc u ed documen s;
Sea ch based on keywo ds;
Concep o ele ance.
Due o he la ge amoun o in o ma ion a ailable in ex sou ces, he e a e many applica ions o
in o ma ion e ie al, such as on-line lib a y ca alogue sys ems, online documen managemen sys ems,
and, as men ioned by [65], Web sea ch engines as Google Sea ch Engine.
4.1.2 In o ma ion Ex ac ion
Ex ac ion p ocess is esponsible o iden i ying exis en keywo ds and ela ionships in a ex . Acco ding o
[82], “ he gene al goal o in o ma ion ex ac ion is o disco e s uc u ed in o ma ion om uns uc u ed o
semi-s uc u ed ex .”
I is done h ough a p ocess called pa e n ma ching, which sea ches o p ede ined sequences
in he ex . The so wa e in e s he ela ionships be ween all he iden i ied da a o gi e a meaning ul
in o ma ion.
Fo example, gi en he sen ence:
In 1993, Palhinha, Toninho Ce ezo and Mulle sco ed he goals o São Paulo in he in e club wo ld cup
agains Milan
we can ex ac he ollowing in o ma ion,
Playe O (Palhinha, São Paulo)
Playe O (Toninho Ce ezo, São Paulo)
Playe O (Mulle , São Paulo)
Such in o ma ion can be p esen ed o an end use , o can be used as sou ce o o he sys ems such
as sea ch engines and da abase managemen sys ems o p o ide be e se ices o end use s.
This p ocess is depic ed in Figu e 15.
4.1.3 Ca ego iza ion
Ca ego iza ion in ol es iden i ying he main hemes o a documen and o ganizing hem in o a ixed numbe
o p ede ined ca ego ies. Using machine lea ning echniques, he sys em “lea ns”how o classi y om
examples, pe o ming he ca ego y assignmen au oma ically. This is a supe ised lea ning p oblem.
34
4.1. APPLICATIONS OF TEXT MINING
Figu e 15: P ocess o In o ma ion Ex ac ion om Tex s. Sou ce: au ho
Du ing he ca ego iza ion p ocess, a compu e p og am will see he documen as a “s emmed bag
o wo ds”, i.e., a se o indi idual wo ds whe e each wo d is “s emmed”(as will be desc ibed a subsec-
ion 4.2.2), sui able o he lea ning algo i hm and he classi ica ion ask. This p ocess o changing he
documen is pa o p ep ocessing echniques, ha is desc ibed a sec ion 4.2.
Di e en om in o ma ion ex ac ion, acco ding o [199] “ca ego iza ion only coun s wo ds ha appea
and hen iden i ies he main opics ha he documen co e s. Ca ego iza ion o en elies on a glossa y o
which opics a e p ede ined, and ela ionships a e iden i ied by looking o la ge e ms, na owe e ms,
synonyms, and ela ed e ms.”
A good example o classi ica ion can be seen in Gmail1o o he mailboxes, whe e he messages a e
au oma ically classi ied in some di e en ca ego ies such as spam, social and p omo ions.
4.1.4 Na u al Language P ocessing
Na u al Language P ocessing (NLP) consis s o he de elopmen o compu a ional models o pe o m asks
ha ely on in o ma ions exp essed in some na u al language ( o example, ansla ion and in e p e a ion
o ex and human-machine in e ace) [170].
Acco ding o [26], he esea ch in NLP is ocused, essen ially, on h ee aspec s o communica ion in
na u al language:
• Sound: phonology;
• S uc u e: mo phology and syn ax;
• Meaning: seman ic and p agma ic.
Phonology is ela ed o he ecogni ion o sounds ha compound he wo ds o a language. Mo phol-
ogy ecognizes wo ds ega ding p imi i e uni s ha comp ise i ( o example ”
wa ched
”→wa ch + ed).
The syn ax de ines he s uc u e o a sen ence, based on how he wo ds a e ela ed in he sen ence, as
1h p://www.gmail.com
35

CHAPTER 4. TEXT MINING AND NLP
illus a ed in Figu e 16. The seman ics associa es a e a meaning wi h a syn ac ic s uc u e, ega ding he
meanings o he wo ds composing i . Finally, p agma ics show how con ex con ibu es o meaning (e.g.
in he con ex blockbus e , ”
classic
”→ e e s o old ilm which won p izes).
Figu e 16: Syn ac ic T ee
4.2 Techniques o Tex P ep ocessing
In o de o ha e asse i e esul s in ex mining ope a ions, i is necessa y o ex ac he ele an in o ma ion
and a oid he i ele an in o ma ion. Fo his eason, ex mining uses a ious p ep ocessing echniques
o iden i y and ex ac s uc u ed ep esen a ions om aw uns uc u ed da a sou ces.
Acco ding o [50] “p ep ocessing asks gene ally con e he in o ma ion om each o iginal da a
sou ce in o a canonical o ma be o e applying a ious ypes o ea u e ex ac ion me hods agains hese
documen s o c ea e a new collec ion o documen s ully ep esen ed by concep s.”
Despi e classi ying ex mining p ep ocessing echnique, he use o mos algo i hms in ex mining
p ep ocessing ac i i ies is no es ic ed o pa icula asks, and se e al qui e di e en algo i hms can
sol e a majo pa o he p oblem. O en, he same algo i hm is used alone o in combina ion wi h o he
algo i hms o di e en asks, cons i u ing di e en echniques. Fo ins ance, Hidden Ma ko models
(HMMs) can be used o pa -o -speech (POS) agging and named-en i y ecogni ion (NER).
In gene al, each p ep ocessing echnique ecei es an uns uc u ed documen as inpu and p oceeds
o add in o ma ion o he s uc u e by analysis he p esen ea u es. When inishing, he mos impo an
in o ma ion abou meaning- ep esen ing ea u es a e used o he ex mining, whe eas he es is disca ded.
The majo di e ence be ween p ep ocessing echniques is ela ed o he na u e o he inpu ep esen a ion
and he ou pu ea u es.
While NLP-based echniques use and p oduce domain-independen linguis ic ea u es, ex ca ego iza-
ion and in o ma ion ex ac ion (IE) echniques deal wi h he domain-speci ic knowledge. One s ill unsol ed
p oblem is o combine he p ocesses o di e en echniques ins ead o combining he esul s. Fo ins ance,
POS ambigui ies gene ally can be sol ed by sea ching a he syn ac ic oles o he wo ds. In he same way,
36
4.2. TECHNIQUES OF TEXT PREPROCESSING
s uc u al ambigui ies can be esol ed h ough domain-speci ic in o ma ion. Fu he mo e, a la ge pa
o he ex in any documen does no con ain ele an in o ma ion bu mus be p ocessed be o e being
conside ed useless and disca ded in he inal s age. I u ns he p ocess ex emely ine icien . Thus, he
p ocesses mus be execu ed in pa allel, exchanging in o ma ion wi h each o he . Howe e , because he
algo i hms we e c ea ed o di e en asks, i is e y di icul o edesign hem o un simul aneously. The e
a e some a emp s o ind an algo i hm, o a se o algo i hms o pe o m mos o he p ep ocessing ask
in a single la ge s ep.
P ep ocessing is a e y impo an s ep in ex mining p ocesses and applica ions. I is he i s s ep
no only o ex mining app oaches bu also in da a mining. The e a e se e al p ep ocessing echniques
used o ex ac in o ma ion om ex , and hei usage is acco ding o he cha ac e is ics o he in o ma ion
desi ed. Despi e some echniques we e c ea ed in da a mining, hey a e used in ex mining app oaches,
since he same echnique can be used o bo h in o ma ion ex ac ion, in o ma ion e ie al, o combined.
Some mos used echniques a e desc ibed below.
4.2.1 Tokeniza ion
Tokeniza ion is conside ed one o he g and challenges o NLP and is con en ionally in e p e ed as b eaking
up “na u al language ex [...] in o dis inc meaning ul uni s (o okens)”[87].
In o de o occu mo e sophis ica ed p ocessing, he ex s eam mus be spli in o inie meaning ul
cons i uen s. Documen s can be spli in o chap e s, sec ions, pa ag aphs, sen ences, wo ds, and e en
syllables o phonemes, acco ding o he needs.
The mos used app oach in ex mining sys ems consis s in b eaking he ex in o sen ences and
wo ds, which is called okeniza ion. Possibly, he mos di icul ask in iden i ying sen ence in he English
language is dis inguishing he di e ence be ween a pe iod ha signals he end o a sen ence and a pe iod
ha is pa o a p e ious oken like M ., D ., e c. and o he s.
I is common o he okenize also o ex ac oken ea u es. These a e usually simple ca ego ical
unc ions o he okens desc ibing some supe icial p ope y o he sequence o cha ac e s ha make up
he oken. Among hese ea u es a e ypes o capi aliza ion, he inclusion o digi s, punc ua ion, special
cha ac e s, and so on.
Howe e , when okenizing a ex , i is impo an o be awa e o some p oblems as:
• Di e en languages - Languages ha do no ma k wo d bounda ies (like whi e spaces) o di e en ia e
he okens, as Chinese and Ge man, p esen a challenge because an o iginal wo d would be b oken
in 2 o mo e okens;
• Punc ua ion - Unless ex p o ide some punc ua ion, i is ha d o ind he end-o -sen ence. In e p e
“apples, bananas, g apes”mus be he same as “apples bananas g apes”;
37
CHAPTER 4. TEXT MINING AND NLP
• Hyphens - Wo ds ha con ain hyphens mus be conside ed as a single wo d, as middle-o ice
while wo ds connec ed by g amma ically equi ed hyphens, such as compu e -based, should be
conside ed mul iple okens;
• Apos ophes - Di e en han hyphens, apos ophes mus be conside ed as 2 di e en wo ds (
“we’ e
he e”
⇒
“we a e”“he e”
), howe e , o possessi es, he ule is conside ed as a single wo d. I would
be done ca e ully o a oid unde s and mis akes, as
“i ’s”
and
“i s”
;
• Tokens ha a e no wo ds - Some imes is needed o in e p e o he ex di e en han wo ds. Fo
ins ance, license pla e o ZIP codes. In hese cases, i will be necessa y o cus omize o handle he
si ua ions.
4.2.2 S emming
A s emming algo i hm is esponsible o ob aining he s em o a wo d, which is, i s mo phological oo ,
h ough clea ing he pa s o he wo d ha b ing g amma ical o lexical in o ma ion. In bo h cases, hese
pa s do no change he concep which wo d is ela ed o as he seman ic in o mali y has been p o en in he
li e a u e, especially in languages ha a e highly in lec i e [158] and in sho documen s [93], ega ding
ecall and p ecision.
The pu poses o a s emming algo i hm can be classi ied in o 3 di e en app oaches:
A. Clus e ing wo ds acco ding o hei opic - Wo ds which a e de i a ions om he same s em belong
o he same concep om he s em (e.g., d i e, d i en, d i e ). These de i a ions a e gene a ed
h ough appended a ixes (p e ixes, in ixes, and/o su ixes) bu , in gene al, and mo e speci ically
in English, only su ixes a e conside ed, as gene ally p e ixes and in ixes modi y he meaning o he
wo d, and s ipping hem would lead o e o s o bad opic de e mina ion [77];
B. The possibili y o IR p ocess imp o emen - Expanding he que y o ob ain mo e p ecise esul s
allows i o be e ined by eplacing he con ained e ms o hei ela ed opics p esen in he col-
lec ion, o adding hese opics o he o iginal que y. This p ocess can be done au oma ically and
anspa en ly o use s o he sys em can p opose one o mo e imp o ed o mula ions o he que y
o use s le ing hem decide i any o hem is mo e speci ic and de ines be e hei in o ma ion
needs. Acco ding [200], “e en i in e ac i e que y expansion is be e in p inciple because he use
has mo e eedback on wha is happening, ypically i canno be done di ec ly wi h he esul o
s emming, as s ems usually a e no unde s andable by humans”;
C. Reduc ion o he dic iona y - Once he whole ocabula y con ained in he o iginal unp ocessed
collec ion o documen s can be educed o a se o opics o s ems, i would equi e less space o
s o e he s uc u es used by an in o ma ion e ie al sys em and consequen ly also would ligh he
compu a ional load o he sys em.
38
4.2. TECHNIQUES OF TEXT PREPROCESSING
In he li e a u e, i is possible o ind se e al di e en implemen a ions o s emming algo i hms. The
mos known s emming algo i hms used a e: Lo ins s emme [109], Dawson s emme [31], Po e s em-
me [159], Paice/Husk s emme [147].
4.2.2.1 Lo ins s emme
The Lo ins s emme algo i hm is composed o wo s eps: su ix emo al and ea men o he emaining
s em. The su ix iden i ica ion is made by ma ching he wo d’s e mina ion wi h he longes su ix om a
lis o 294 su ixes. A e ma ching he su ix, i is applied one o he 35 associa ed applica ion ules, and
he emaining s em is ea ed o sol e some linguis ic excep ions (like ending in double d o double ).
Fo example, he wo d na ionally inishes wi h a ionally and is associa ed wi h condi ion B, which
ela es o “minimum s em leng h = 3.”I emo ing a ionally would lea e a s em o leng h 1 and conse-
quen ly would be ejec ed. Bu i also has ending ionally wi h associa ed condi ion A. Condi ion A is “no
es ic ion on s em leng h”, so ionally is emo ed, lea ing “na .”
4.2.2.2 Dawson s emme
Dawson s emme algo i hm is an ex ension o he Lo ins algo i hm which has a wide lis o su ixes [185].
In addi ion o Lo ins s emme , Dawson s emme also has a single pass s emme which makes i pe o ms
as . The su ixes a e s uc u ed and s o ed by hei leng hs and las le e s. In ac , hey a e s uc u ed as
a se o sepa a ed cha ac e ees o quick access. So, he bene i o Dawson s emme is i co e s mo e
su ixes compa ed o Lo ins s emme and Dawson s emme . Besides ha , i also pe o ms as . Howe e ,
he weaknesses o Dawson s emme include i s complexi y and lacks s anda d eusable implemen a ion.
4.2.2.3 Po e s emme
Po e s emming algo i hm p obably is he mos known s emming me hods. Simple, i has 60 su ixes,
wo ans o ma ion ules, and con ex -sensi i e ule o de e mine whe he a su ix should be emo ed o
no .
The algo i hm is composed o 5 s eps, each one con aining speci ic ules o emo ing su ixes o
ans o ming he wo ds: he i s is esponsible o handling in lec ional su ixes; he second, hi d and
ou h a e esponsible o handling de i a ional su ixes while he i h is esponsible o ecoding.
In a o mal model, hei ules a e simple can be seen like his:
𝑁𝑆 =𝑓(𝐶, 𝑆)(4.1)
whe e:
NS = new su ix
C = Condi ion
39
5
Wo d Rep esen a ion
The ep esen a ion o wo ds in na u al language p ocessing (NLP) can be conside ed as one o he basic
building blocks because makes possible he unde s anding o a human language by a machine. Acco ding
o [197], “a wo d ep esen a ion is a ma hema ical objec associa ed wi h each wo d, o en a ec o . Each
dimension’s alue co esponds o a ea u e and migh e en ha e a seman ic o g amma ical in e p e a ion,
so we call i a wo d ea u e”.
5.1 Wo d Rep esen a ion App oaches
In he las yea s, he app oaches o wo d ep esen a ion gained an inc eased impo ance in he NLP
p ocesses. F om simple echniques o coun ing wo d equencies o iden i ying he con ex o wo ds, each
app oach has p os and cons in hei u iliza ion.
5.1.1 Dic iona y Lookup
Dic iona y Lookup is he simples app oach o wo d ep esen a ion, consis ing in a wo d ID lookup in a
dic iona y. Due o hei simplici y, i is di icul o ind a sophis ica ed de ini ion abou dic iona y lookup,
being essen ially a se o key/ alue pai s, whe e he key is an unique wo d and he alue is an unique ID
which ep esen s he wo d.
The wo ds con ained in he se o keys a e collec ed om a co pus - which can be collec ion o wo ds,
sen ences o ex s - whe e he wo ds a e p ep ocessed (using some echniques p esen ed in Sec ion 4.2),
he ea e called “
ocabula y
”.
Then, o each gi en wo d, he dic iona y e u ns he co esponding wo d’s ID by looking i up in he
dic iona y. I he wo d is no p esen in he dic iona y, he dic iona y should e u n an “Ou o Vocabu-
la y”code. An example o his kind o dic iona y is p esen ed in Table 4.
Despi e being easie and simple o implemen , his app oach has some impo an d awbacks which
mus be aken in o conside a ion. By conside ing IDs as in ege numbe s, he model migh assume he
exis ence o ela ions jus conside ing he o de o his IDs. Fo example, i he dic iona y con ains en ies
46

5.1. WORD REPRESENTATION APPROACHES
Table 4: Dic iona y Lookup example
Wo d ID
plane 1
wa e 2
mo o cycle 3
goal 4
objec i e 5
Po ugal 6
such as 1: “playe ”and 2: “ e e ee”, he highe ID numbe migh be inco ec ly conside ed as “mo e
impo an ”by he Machine Lea ning models han he leas ID numbe s. On he o he hand, using he IDs
o ep esen in o ma ion, such as size measu es 1: “small”, 2: “medium”, 3: “la ge”is sui able o his
case because he e is a na u al o de ing in he da a.
5.1.2 One Ho Encoding / Bag o Wo ds
One ho encoding / Bag o wo ds is a well-known p ocess in NLP ha maps he occu ence o all wo ds
exis en in a co pus in o a ec o . Thus, i is possible o ep esen any sen ence as a ec o o in ege s.
This app oach conside s ha a ex can be ep esen ed as a lis o sen ences, and on he o he hand,
a sen ence can be ep esen ed as a lis o wo ds (o okens, as p esen ed in Subsec ion 4.2.1).
So, he numbe o dis inc wo ds exis en in he ex , deno es he wo d ec o size, whe e each posi ion
o he a ay ep esen s a wo d a he same index in he se o dis inc wo ds (whe e his se is gene ally
alphabe ically so ed).
The esul ing sen ence’s ep esen a ion is an a ay o in ege s con aining a each posi ion he equency
o he wo d in he sen ence. This app oach is known as Bag o Wo ds model, because i loses he o de
o how he wo ds appea in he sen ence.
An example o he One Ho Encoding / Bag o Wo ds is p esen ed in Figu e 17.
Figu e 17: One Ho Encoding / Bag o Wo ds Rep esen a ion
A a ia ion in One Ho Encoding / Bag o Wo ds c ea ion is iden i ying he ele ance o each wo d in he
sen ence conside ing he exis en co pus ins ead o hei equency. This can be achie ed using di e en
solu ions, howe e , he mos known is he
Te m F equency - In e se Documen F equency
(TF-IDF), as
p esen ed in Sec ion 4.2.6.
47
CHAPTER 5. WORD REPRESENTATION
A d awback o his app oach is ha he ep esen a ion o se e al sen ences will p oduce immense
and spa se ec o s. When conside ing la ge ex s, whe e he numbe o di e en wo ds is highe , he
ep esen a ion o each wo d o sen ence in ec o s will equi e la ge memo y o compu a ion, because
each ec o has he same size as he numbe o dis inc wo ds. Mo eo e , once ha each sen ence has a
iny subse o all dis inc wo ds, he ec o s will ha e in hei majo i y ze o alues as dimensions.
O he weakness o his app oach is due o he posi ional e e ence o he wo ds. As he model does
no ake in o conside a ion he ela ionship o p ecedence among he wo ds, di e en sen ences using he
same wo ds will be ep esen ed as he same ec o . Fo example, he sen ences “John lo es chocola e
and Anna ha es o s udy”and “Anna lo es chocola e and John ha es o s udy”will be ep esen ed as he
same ec o .
5.1.3 Wo d Embeddings
The main p oblem on he ep esen a ions based on ocabula y - as
dic iona y lookup
and
one ho encoding
- is ha all ail in no o cap u e he ela ional s uc u e o he lexicon. The eason o his p oblem is ha
he app oaches do no conside as ele an he wo d’s posi ion in he ex . So, de e mining he con ex
in which he wo ds we e p esen ed is impossible. Howe e , di e en om he app oaches p esen ed
p e iously, he Wo d Vec o s ake in o conside a ion he p oximi y among wo ds in ex s and simila i y
when ep esen ing hem.
The cha ac e is ic o he Wo d Embeddings is o ep esen wo ds as ea u es in ec o s, whe e each
en y s ands o one hidden ea u e inside he wo d meaning, allowing o e eal seman ic o syn ac ic
dependencies.
An ini ial app oach o desc ibe hese ec o s is c ea ing a co-occu ence ma ix, i.e., a ma ix con aining
he numbe o coun s o each oken (wo d) and a lag indica ing i he oken is he nex neighbou in he
sen ence.
Fo example, conside ing he sen ence “
I lo e chocola es, bu I ha e spo s
”, a co-occu ence ma ix
o each wo d can be desc ibed as p esen ed in Table 5.
Table 5: Co-occu ence ma ix
Token I lo e chocola es bu ha e spo s
I0 1 0 1 1 0
lo e 1 0 1 0 0 0
chocola es 0 1 0 1 0 0
bu 1 0 1 0 0 0
ha e 1 0 0 0 0 1
spo s 0 0 0 0 1 0
So, he wo d ec o s o he sen ence abo e would be:
48
5.1. WORD REPRESENTATION APPROACHES
I = [0, 1, 0, 1, 1, 0]
lo e = [1, 0, 1, 0, 0, 0]
chocola es = [0, 1, 0, 1, 0, 0]
bu = [1, 0, 1, 0, 0, 0]
ha e = [1, 0, 0, 0, 0, 1]
spo s = [0, 0, 0, 0, 1, 0]
These esul s can p o ide some use ul insigh s. Fo ins ance, he wo ds “
lo e
” and “
ha e
” a e neigh-
bou s o he nouns “
chocola e
” and “
spo s
” as well as is neighbou o “
I
”. These p oximi ies and se-
quences indica e ha hese wo ds mus be e bs.
When using wo d ec o s o expand he da ase s, some calcula ions can p o ide in o ma ion abou
he wo ds used in simila con ex s - as p esen ed in Subsec ion 5.2 - gi ing us insigh s o hei seman ic
and syn ac ic ela ions.
Acco ding o [127], “we ind ha he lea ned wo d ep esen a ions in ac cap u e meaning ul syn ac ic
and seman ic egula i ies in a e y simple way. Speci ically, he egula i ies a e obse ed as cons an ec o
o se s be ween pai s o wo ds sha ing a pa icula ela ionship. Fo example, i we deno e he ec o o
wo d i as xi, and ocus on he singula /plu al ela ion, we obse e ha xapple — xapples ≈xca — xca s,
x amily — x amilies ≈xca — xca s, and so on. Pe haps mo e su p isingly, we ind ha his is also he case
o a a ie y o seman ic ela ions”.
Ye , as he dimensionali y o wo ds inc eases acco ding o he size o he co pus, p opo ionally, he
ma ices will g ow in size - emaining spa se and comp omising s o age e iciency. This p oblem has been
ocus o esea ch abou op imizing he ep esen a ion o wo d ec o s. The mos known app oaches a e
Wo d2Vec and GloVe.
5.1.3.1 Wo d2Vec
Wo d2Vec is an open-sou ce ool, de eloped by [128], which is used o calcula e ep esen a ions o wo ds
as ec o s. Acco ding o [102], Wo d2Vec “is a popula choice o p e- aining he p ojec ion ma ix 𝑊∈
R𝑑𝑥|𝑉|whe e 𝑑is he embedding dimension wi h he ocabula y 𝑉. As an unsupe ised ask ha is
ained on aw ex , i builds wo d embeddings by maximizing he likelihood ha wo ds a e p edic ed om
hei con ex o ice e sa. As an unsupe ised ask ha is ained on aw ex , i builds wo d embeddings
by maximizing he likelihood ha wo ds a e p edic ed om hei con ex o ice e sa.”
Wo d2Vec wo ks by aking a co pus as inpu and e u ning wo d ec o s as ou pu . A ocabula y is
cons uc ed du ing he p ocess o lea ning ep esen a ions as ec o s. The ool has de ined in i s s uc u e
wo models o ep esen he ec o s: Skip-G am model and Con inuous Bag o Wo d (CBOW) model, as
p esen ed in Figu e 18.
Bo h models use a hidden laye neu al ne wo k o gene a e ou pu , and he back p opaga ion algo i hm
o upda e, o jus weigh, he pa ame e alues while obse e new examples.
49
CHAPTER 5. WORD REPRESENTATION
Figu e 18: Illus a ion o he Con inuous Bag-o -Wo d (CBOW) and Skip-G am models. Sou ce: [102]
Figu e 19: CBOW ne wo k. Sou ce [53]
In he CBOW model he inpu is a con ex (su ounding wo ds) and he ou pu an omi ed wo d, i.e.,
o his ep esen a ion, he su ounding wo ds a e combined o p edic he middle wo d. I is conside ed
as con ex he wo ds ha a e a ound he a ge wo d 𝑤. An example is o use as con ex he wo wo ds
be o e 𝑤and he wo wo ds a e . In he case o a sen ence 𝑤1𝑤2𝑤3𝑤4𝑤5 he con ex o he wo d 𝑤3
is 𝑤1𝑤2𝑤4𝑤5.
Di e en han he he Bag o Wo ds app oach, he CBOW can conside di e en con ex s o a single
a ge wo d. Fo example, in he sen ences: “Ronaldo sco ed a goal”and “Neyma sco ed a goal”, bo h
“Ronaldo”and “Neyma ”a e con ex s o he wo d “sco ed”. The p ocessing o di e en con ex s is possi-
ble by p ocessing 𝑁 imes he ec o wo d, whe e 𝑁is he numbe o di e en con ex s he wo d appea s
in he co po a. Each 𝑁wo d exis en in o he co po a will p oduce a ec o 𝑊1, in he con ex 𝑘. These
ec o s will eed he hidden laye ha will p oduce a 𝑊2𝑘𝑥𝑛 ma ix o he ou pu laye . In he ou pu laye ,
a so max unc ion will calcula e he p obabili ies o a esul an wo d.
An example o CBOW p ocessing is p esen ed in Fig. 19.
In he Skip-G am model, he objec i e is he in e se o CBOW: gi en a ec o ep esen ing a single wo d,
50
5.1. WORD REPRESENTATION APPROACHES
Figu e 20: Skip-g am ne wo k. Sou ce h ps:// owa dsda ascience.com/wo d2 ec-skip-g am-model-pa -
1-in ui ion-78614e4d6e0b
i can p edic i s con ex . In his case, he inpu is a wo d ha goes h ough a hidden laye and ou pu s he
mos likely con ex . The objec i e, in his case, is o iden i y he weigh s o each wo d calcula ed in he
hidden laye gi en a wo d. Once he hidden laye uses a So max unc ion as ac i a ion unc ion, hese
weigh s will ep esen he p obabili y o he wo ds be he neighbou s o a gi en wo d. A ep esen a ion o
he Skip-G am model is illus a ed in Fig. 20.
5.1.3.2 GloVe
Acco ding o [154], he Global Vec o s o Wo d Rep esen a ion (GloVe) “is an unsupe ised lea ning algo-
i hm o ob aining ec o ep esen a ions o wo ds. T aining is pe o med on agg ega ed global wo d-wo d
co-occu ence s a is ics om a co pus, and he esul ing ep esen a ions showcase in e es ing linea sub-
s uc u es o he wo d ec o space.”
Despi e bo h Wo d2Vec and GloVe gene a e wo d ec o s based on wo d neighbou hood, hei di e -
ence is ha GloVe uses he wo d co-occu ence global ye o gene a e he wo d ec o s, no elying only
on local s a is ics (local con ex wo ds) as Wo d2Vec.
The model is based on he idea ha he p opo ions o p obabili ies o a wo d co-occu ence ma ix
can b ing some o m o meaning ha can be ansla ed as a ec o s di e ence. The e o e, he objec i e is
o iden i y he ela ion among he wo ds and ep esen hem as wo d ec o s so ha hei scaled p oduc
is equal o he loga i hm o he p obabili y o he wo ds’ co-occu ence. As he loga i hm o a a io is equal
o he di e ence in loga i hms, his objec i e associa es he p opo ions o co-occu ence p obabili ies wi h
ec o di e ences in he ec o space o wo ds. I c ea es wo d ec o s ha pe o m well in wo d analogy
asks and in simila i y and named en i y ecogni ion asks. An example o GloVe p ocessing is p esen ed
in Fig.21.
51

CHAPTER 5. WORD REPRESENTATION
Figu e 21: GloVe p ocessing. Adap ed om h ps://www.kdnugge s.com/2018/04/implemen ing-deep-
lea ning-me hods- ea u e-enginee ing- ex -da a-glo e.h ml
5.2 Tex simila i y
In Na u al Language P ocessing, one o he mos impo an p oblems is how o handle he simila i y o
wo ds and ex s. Simila ex s and wo ds can ep esen he same in o ma ion and emo ions, and, once i
is impossible o know all wo ds o all con ex s, knowing i an unknown wo d o sen ence is simila o a
known wo d o sen ence inc eases he p obabili y o he compu e “unde s and” he meaning and emo ion
o i . So, an answe o he ques ion ”how o de e mine how ’close’ wo ex s o wo ds a e ?” is
undamen al o a good comp ehension o a ex .
A pa o hese p oblems occu due o he spoken language ichness, whe e di e en wo ds ha e he
same meaning and a single wo d can assume di e en meanings. The e a e di e en easons o ha
such as geog aphical dis ance and con ex ual si ua ions. Fo example, speake s om Po ugal and B azil
sha e he same language - Po uguese - bu some wo ds as
apa iga
(
gi l
in Po ugal and
hooke
in B azil)
and
a o
(coa in Po ugal and ac in B azil) illus a e he e ec o
dis ance
be ween he loca ion o he
speake s. In he a scena io in B azil, he exp ession
“queb e a pe na”
(b eak he leg) is equi alen o
“good luck”
, howe e , in o he di e en con ex s, his exp ession is conside ed an o ensi e wish.
O he po en ial sou ce o p oblems occu when conside ing he dis ibu ion o he wo ds in sen ences
o e alua e i hey a e simila . Fo example, he sen ences he dog b oke he ca ’s bed and he ca
slep a he dog’s bed a e e y simila , because hey sha e 4 ou o 6 wo ds. Howe e , i does no ake
in o conside a ion he meaning o he wo ds o he en i e sen ence.
Thus, his closeness mus be e alua ed bo h in a su ace closeness (conside ing a lexical simila i y)
and meaning closeness (seman ic simila i y).
In he li e a u e he e a e se e al app oaches o measu e he simila i y be ween wo ds and ex s. In
he ollowing sec ions, some well known echniques o measu e he simila i ies be ween ex s and wo ds
will be desc ibed.
5.2.1 Jacqua d Coe icien
Acco ding o [191], “ he Jacqua d coe icien measu es he simila i y be ween ini e sample se s, and is
de ined as he size o he in e sec ion di ided by he size o he union o he sample se s”.
When ansposing his de ini ion o NLP scena io, i is s aigh o wa d o iden i y ha each sample se
ep esen s a sen ence and hei con en is composed o he se o unique wo ds exis en on each sen ence.
52
5.2. TEXT SIMILARITY
Fo example, in he sen ences:
• Sen ence A -
“The boy lo es play socce ”
• Sen ence B -
“The gi l wan s o play he ideogame”
we ha e
A = {
he, boy, lo es, play, socce
}
B={
he, gi l, wan s, o, play, he , ideogame
}
So, he Jacqua d coe icien o hese sen ences would be:
𝐽𝑎𝑐𝑞𝑢𝑎𝑟𝑑𝐶𝑜𝑒𝑓 𝑓 𝑖𝑐𝑖𝑒𝑛𝑡(𝐴,𝐵)=𝐴∩𝐵
𝐴∪𝐵=2
10 =0.2
esul ing in a simila i y o 20% be ween he sen ences.
Despi e i s ease o use, he Jacqua d coe icien is conside ed a “weak” measu e o simila i y. The
weakness o he app oach happens because i s applica ion is based only on he equency o wo ds in
he ex s. Howe e , di e en wo ds can ha e he same meaning in a sen ence and; e en i applied p e-
p ocessing echniques o ex , such as S emming and Lemma iza ion - as p esen ed in sec ions 4.2.2 and
4.2.3 espec i ely - he synonyms will no be iden i ied.
Fu he mo e, his app oach does no cap u e he con ex o he sen ences. The sen ence
“I saw a man
on a hill wi h a elescope”
can be in e p e ed in di e en ways acco ding o he con ex which is ela ed o.
An example o di e en in e p e a ions o his sen ences a e:
• The man seen had a elescope;
• I used a elescope o saw he man.
So, disca ding he con ex when conside ing he simila i y o sen ences can b ing misunde s andings.
5.2.2 Euclidean Dis ance
The Euclidean Dis ance is - possibly - he simples app oach o measu e he simila i y be ween wo ex s. I
uses Py hago ean Theo em o de e mine he dis ance be ween wo poin s in a plane o in a n-dimensional
space.
In a gene aliza ion o an n-dimension, he Euclidean Dis ance can be ep esen ed as he o mula:
𝐷𝑖𝑠𝑡(𝑝,𝑞)=
𝑛
Õ
𝑖=1
(𝑝𝑖−𝑞𝑖)2
53
CHAPTER 5. WORD REPRESENTATION
Figu e 22: Euclidean Dis ance. Sou ce h ps://mo ioh.com/p/05256ee15 96
whe e 𝑛is he numbe o dimension exis en and 𝑝and 𝑞 ep esen poin s in he space.
When conside ing he Euclidean Dis ance o ex ual simila i y measu emen , he mos common ap-
p oach is o de ine he se o wo ds in he ex as dimensions and he numbe o hei occu ences as he
alues in he dimension. Howe e , his app oach ails because he ex s gene ally ha e di e en sizes and
wo ds - and consequen ly di e en dimensions. So, calcula ing he Euclidean Dis ance be ween ex s wi h
di e en sizes and wo ds will p oduce un ealis ic alues.
Fo example, suppose ha in 3 di e en schola books (Ma h, Psychology and Philosophy), he wo ds
ha mony
and
heo y
occu s 10, 40 and 70 and 60, 20 and 25 espec i ely. In a 2D- ep esen a ion, i is
possible o ansla e his in o ma ion as p esen ed in Fig. 22.
Finally, he Euclidean Dis ance can be measu ed as he dis ance be ween he poin s.
5.2.3 Cosine Simila i y
The Cosine Simila i y is one o he mos used echnique o measu e he simila i y be ween ex s, being
used oge he wi h wo d embeddings. The concep is based on he idea o all ex s a e ep esen ed as
ec o s - as p esen ed in sec ions 5.1.2 and 5.1.3, and hei simila i ies a e calcula ed as a p oduc o
hese ec o s.
Fo example, le ’s conside wo ec o s −→
𝑎and −→
𝑏 ep esen ing wo wo ds espec i ely. These ec o s
can be ep esen ed as −→
𝑎=(𝑎1, 𝑎2, 𝑎3, ...)and −→
𝑏=(𝑏1,𝑏2,𝑏3, ...), whe e 𝑎𝑛and 𝑏𝑛a e componen s o
he ec o . The alue o each componen can be he occu ence equency o each wo d, he TF-IDF alue
o each wo d o he wo d embedding ec o and 𝑛is he dimension o he ec o .
54
5.2. TEXT SIMILARITY
Figu e 23: Righ -Angled T iangle
Based on he ma hema ical p inciple ha i wo elemen s ha e some deg ee o simila i y, hey a e
mul iple by some scale, i is possible o in e ha he simila i y be ween he ec o s −→
𝑎and −→
𝑏is he
p oduc be ween hese wo ec o s, i.e., he do p oduc −→
𝑎.−→
𝑏.
The geome ic de ini ion o do p oduc , is:
−→
𝑎 .−→
𝑏=||−→
𝑎||.||−→
𝑏|| cos 𝜃
When analysing a igh -angled iangle, as p esen ed in Fig. 23, being A and B ep esen ed by he
di ec ions o −→
𝑎and −→
𝑏and an angle 𝜃, i is possible o iden i y ha he p ojec ion o −→
𝑎in o −→
𝑏is a mul iple
o −→
𝑏.
The alue o |𝐴|𝑐𝑜𝑠𝜃 is called cosine simila i y be ween −→
𝑎and −→
𝑏. So, as highe is he 𝜃angle, he
lesse will be he p ojec ion o −→
𝑎in o −→
𝑏.
In a si ua ion whe e he 𝜃=90◦, he e will no be a p ojec ion om −→
𝑎in o −→
𝑏, so i is possible o
claim ha he ec o s (and he ex s whose hey ep esen ) do no ha e a ela ionship, as i 𝜃>90◦, he
p ojec ion will esul in a nega i e alue.
Thus, he ange o alues p o ided by he cosine simila i y is om -1 o 1, which is he same ange
o Pea son’s co ela ion coe icien (𝑟2). Once he 𝑟2p o ides a scale o in e p e a ion o how da a a e
ela ed, as p esen ed in Table 6, i is possible o use he same scale o in e p e how simila wo wo ds
a e.
Fo example, in Sec ion 5.1.3, he ec o s o he wo ds lo e and ha e a e:
lo e = [1, 0, 1, 0, 0, 0]
ha e = [1, 0, 0, 0, 0, 1]
To iden i y how simila he wo ds a e, i is necessa y o check he cosine simila i y be ween he wo ds
- which is 0.5 - and in e p e his alue acco ding o he Table 6.
55
CHAPTER 6. EMOTIONAL STATE CLASSIFIER
A. Collec messages;
B. P ep ocess all messages;
C. C ea es and upda es a pe sonal ocabula y;
D. Calcula e he emo ional dis ibu ion o he messages acco ding o he ocabula y.
A he lea ning s age, he p ocesses use he emo ional dis ibu ion o he messages o c ea e machine
lea ning models.
The models c ea ed (one pe au ho in Time Se ies models and all-au ho s models in Classi ica ion
and Reg ession models) will eed he P esen a ion Module and p o ide he ou pu o ma o he Web
API eques s.
6.1.2 Web API
Ini ially, he a chi ec u e was planned o ha e on -end and back-end modules, howe e , du ing i s de el-
opmen , i was ealized ha he e is no need o a on -end module. This led o he c ea ion o a single
module o p o ide he emo ional s a e de ec ion se ice. Thus, i was decided o c ea e a Web API o
p o ide he de ec ion o he emo ional s a e, enabling any so wa e de elope o consume ha se ice
and p o ide his unc ionali y on his so wa e, ega dless o he ype o de ice unde which he so wa e is
unning.
So, he Web API has me hods ha ecei e ex s independen ly om hei o igins, such as iles, social
media, sma phone logs, SMS messages, e c. In o de o inc ease he lexibili y, bo h inpu and esponse
da a will communica e in an in e ope able o ma . Fo his eason, all me hods in hese ca ego ies use
JSON as o ma ype o inpu s and ou pu s, enabling he so wa e de elope o use he ope a ing sys em
as p og amming language.
A e hose conside a ions, ou Web API me hods we e c ea ed:
• Inpu T ainingDa a - Is he en ance doo o inpu da a o aining;
• Reques Classi ica ion - Is he me hod esponsible o p o ide he emo ional s a e classi ica ion based
on a se o gi en messages;
• Reques Reg ession - Is he me hod esponsible o e u n a se o emo ional s a e pe cen ages based
on a se o gi en messages;
• P edic Emo ionalLe els - Is he me hod ha p edic s and e u ns he le el o each Pluchik’s 8 basic
emo ion, aking in o conside a ion he pas le el o he emo ions.
The Web API p o ides a communica ion channel wi h he clien so wa e and o his eason, he
o ma o bo h eques and esponse me hods mus be known. Acco ding o he Web API me hod, he
JSON o ma s ha mus be used a e di e en , as p esen ed in nex sec ions.
62

6.1. ARCHITECTURE
6.1.3 Inpu Da aT aining
The
Inpu Da aT aining
is he API me hod esponsible o allow he inpu o labelled ex s om di e en
au ho s and sou ces o ain he models o p edic he emo ional s a e and u u e emo ional le els. The
inpu can be used o p o ide new da a o add da a o he exis ing one, ega ding some speci ic ex w i e
( he au ho ).
I s low con ains h ee di e en pa hs ha occu sepa a ely, and is exac ly he lea ning phase, being
esponsible o p o ide all da a needed o eed he models o be ained. The low s a s when he messages
a e ecei ed; he hose messages a e p ep ocessed by a Da a P epa a ion ask o emo e unnecessa y
in o ma ion and simpli y he ex s o be p ocessed.
A e he p ep ocessing, he low is di ided in o 2 pa hs: he i s one s a s wi h he Vocabula y
Pe sonaliza ion Module o c ea e / upda e he pe sonal lexicon o he ex s w i e ( he au ho ). La e , he
ex messages ha e hei Emo ional P o ile iden i ied acco ding o he pe sonal ocabula y and inally he
in o ma ion lows o he c ea ion o a Time Se ies Model, whe e a ime-se ies model o each au ho ’s
emo ions is c ea ed.
Following he second pa h, in o ma ion ( ex messages) lows di ec ly o he Emo ional P o ile iden i i-
ca ion o calcula e he dis ibu ion o each basic emo ion in each sen ence. These dis ibu ions will eed 2
pa hs: one esponsible o c ea e a classi ica ion model; and he o he esponsible o c ea e a eg ession
model.
Along he s eps desc ibed abo e, he da a compu ed a e sa ed in a da abase o u u e esea ches
and ollow up he au ho s emo ions o e he ime.
6.1.3.1 Inpu and ou pu da a o ma s
The
Inpu T ainingDa a
me hod ecei es a lis 𝑀𝑒𝑠𝑠𝑎𝑔𝑒𝑠 o s uc u es
𝑇𝑒𝑥𝑡 (𝑡𝑥𝑡, 𝑙𝑎𝑏𝑒𝑙, 𝑎𝑢𝑡ℎ𝑜𝑟, 𝑠𝑜𝑢𝑟𝑐𝑒,𝑑𝑎𝑡𝑒𝑡𝑖𝑚𝑒)
as pa ame e o ain he Classi ica ion Model, he Reg ession Model and he Time Se ies Emo ional Model.
In a o mal de ini ion, i ecei es:
𝑀𝑒𝑠𝑠𝑎𝑔𝑒𝑠 ={𝑡𝑒𝑥𝑡1, 𝑡𝑒𝑥𝑡2, 𝑡𝑒𝑥𝑡3, ...𝑡𝑒𝑥𝑡𝑛}
𝑡𝑒𝑥𝑡𝑖=<𝑡𝑥𝑡, 𝑙𝑎𝑏𝑒𝑙, 𝑎𝑢𝑡ℎ𝑜𝑟, 𝑠𝑜𝑢𝑟𝑐𝑒,𝑑𝑎𝑡𝑒𝑡𝑖𝑚𝑒 >whe e:
𝑡𝑥𝑡 is he ex o be analyzed;
𝑙𝑎𝑏𝑒𝑙 co esponds o he au ho ’s emo ional s a e when p oduced he ex ;
𝑎𝑢𝑡ℎ𝑜𝑟 is an id e e ence o he au ho o he ex ;
𝑠𝑜𝑢𝑟𝑐𝑒 is an iden i ica ion o he sou ce om whe e he da a was inpu ed;
𝑑𝑎𝑡𝑒𝑡𝑖𝑚𝑒 is he da e & ime when he message was p oduced.
63
CHAPTER 6. EMOTIONAL STATE CLASSIFIER
An example o he
Inpu T ainingDa a’s
inpu o ma is p esen ed below:
1{
2"Messages":{
3"Tex ":[
4{
5"da e ime":"2020-04-20 15:32:35",
6"sou ce":"1",
7"label":"Dep ession",
8"au ho ":"1",
9" ex ":"Some imes I wan o c y wi hou eason"
10 },
11 {
12 "da e ime":"2020-04-22 17:58:10",
13 "sou ce":"1",
14 "label":"Anxie y",
15 "au ho ":"2",
16 " ex ":"I jus wan o wo k a e he lockdown"
17 }
18 ]
19 }
20 }
The
Inpu T ainingDa a’s
me hod e u ns a message in JSON o ma indica ing he s a us o he p ocess,
as p esen ed below:
1{" esponse":"Sucess"}
6.1.4 Reques Classi ica ion
The
Reques Classi ica ion
me hod is he co e o his wo k. I ecei es a se o ex messages and e u ns
he emo ional s a e ela ed o he emo ions de ec ed in he ex s.
In o de o iden i y he au ho ’s emo ional s a e, he pipeline - as p esen ed in Fig. 28 - pe o ms a
sequence o 6 s eps o classi y he emo ional s a e acco ding o he ex s ecei ed.
Figu e 28: Reques Classi ica ion pipeline
64
6.1. ARCHITECTURE
These s eps a e:
1) The me hod ecei es a lis 𝑀o messages o be analysed;
2) The Da a P epa a ion p ep ocess he da a;
3) The Emo ional P o ile iden i ies he emo ions o each sen ence con ained in 𝑀;
4) The sou ce’s classi ica ion model is loaded;
5) The emo ions a e g ouped and no malized and he emo ional s a e is p edic ed using he sou ce’s
classi ica ion model;
6) The in o ma ion is e u ned.
6.1.4.1 Inpu and ou pu da a o ma s
The
Reques Classi ica ion
me hod, ecei es a lis 𝑀o s uc u es𝑇(𝑡𝑒𝑥𝑡,𝑠𝑜𝑢𝑟𝑐𝑒)as pa ame e o p edic
he emo ional s a e. In a o mal de ini ion, i ecei es:
𝑀={𝑡1, 𝑡2, 𝑡3, ...𝑡𝑛}
𝑡𝑖=<𝑡𝑥𝑡, 𝑠𝑜𝑢𝑟𝑐𝑒 >
whe e:
𝑡𝑥𝑡 is he o iginal ex o be analyzed;
𝑠𝑜𝑢𝑟𝑐𝑒 is an iden i ica ion o he sou ce om whe e he da a was inpu ed.
An example o he
Reques Classi ica ion’s
eques is p esen ed below:
1{
2"Messages":{
3"Tex ":[
4{
5"sou ce":"1",
6" ex ":"No hing a all in my li e is unning ok"
7},
8{
9"sou ce":"1",
10 " ex ":"I eally wan o be happy"
11 }
12 ]
13 }
14 }
65
CHAPTER 6. EMOTIONAL STATE CLASSIFIER
The
Reques Classi ica ion’s
esponse e u ns a message in JSON o ma indica ing he s a us o he
p ocess, as illus a ed below:
1{"classi ica ion":"Dep ession"}
6.1.5 Reques Reg ession
The
Reques Reg ession
me hod is an auxilia y me hod o p o ide a mo e de ailed in o ma ion abou he
classi ica ion. I ecei es a se o ex messages and e u ns a lis o all emo ional s a es and hei espec i e
pe cen age, acco ding o he emo ions de ec ed in he ex s.
In o de o iden i y he pe cen age o each emo ional s a e in he messages, he pipeline - as p esen ed
in Fig. 29 - pe o ms a sequence o 6 s eps o calcula e he emo ional s a e’s pe cen age acco ding o he
ex s ecei ed.
Figu e 29: Reques Reg ession pipeline
These s eps a e:
1) The me hod ecei es a lis 𝑀o messages o be analysed;
2) The Da a P epa a ion p ep ocesses he da a;
3) The Emo ional P o ile iden i ies he emo ions o each sen ence con ained in 𝑀;
4) The sou ce’s classi ica ion model is loaded;
5) The emo ions a e g ouped and no malized and he emo ional s a e is p edic ed using he sou ce’s
classi ica ion model;
6) The in o ma ion is e u ned.
6.1.5.1 Inpu and ou pu da a o ma s
The
Reques Reg ession
me hod, ecei es a lis 𝑀𝑒𝑠𝑠𝑎𝑔𝑒𝑠 o s uc u es 𝑇𝑒𝑥𝑡 (𝑡𝑥𝑡, 𝑠𝑜𝑢𝑟𝑐𝑒)as pa ame e
o p edic le els o each emo ional s a e. In a o mal de ini ion, i ecei es:
𝑀𝑒𝑠𝑠𝑎𝑔𝑒𝑠 ={𝑡𝑒𝑥𝑡1, 𝑡𝑒𝑥𝑡2, 𝑡𝑒𝑥𝑡3, ...𝑡𝑒𝑥𝑡𝑛}
𝑇𝑒𝑥𝑡𝑖=<𝑡𝑥𝑡, 𝑠𝑜𝑢𝑟𝑐𝑒 >
66
6.1. ARCHITECTURE
whe e:
𝑡𝑥𝑡 is he ex o be analysed;
𝑠𝑜𝑢𝑟𝑐𝑒 is an iden i ica ion o he sou ce om whe e da a was inpu ed.
An example o he
Reques Reg ession’s
eques is p esen ed below:
1{
2"Messages":{
3"Tex ":[
4{
5"sou ce":"1",
6" ex ":"No hing a all in my li e is unning ok"
7},
8{
9"sou ce":"1",
10 " ex ":"I eally wan o be happy"
11 }
12 ]
13 }
14 }
The
Reques Reg ession’s
esponse e u ns a message in JSON o ma indica ing he le el o he each
emo ional s a e, in a ange om 0 up o 1, as illus a ed below:
1{
2"Emo ionalS a es":{
3"Emo ionalS a e":[
4{
5"Name":"Dep ession",
6"Le el":"0.84"
7},
8{
9"Name":"Happiness",
10 "Le el":"0.04"
11 },
12 {
13 "Name":"Anxie y",
14 "Le el":"0.12"
15 }
16 ]
67

CHAPTER 6. EMOTIONAL STATE CLASSIFIER
17 }
18 }
6.1.6 P edic Emo ionalLe els
The
P edic Emo ionalLe els
p o ides in o ma ion abou an au ho ’s u u e emo ional le els, aking in o
conside a ion he p e ious emo ional le els. This is a ele an in o ma ion because acco ding o he psy-
chological bibliog aphy, some diseases - such as dep ession - need o be ollowed up o a long ime p io
o be diagnosed. Howe e , i is possible an indi idual begins o demons a e dep essi e signals in he las
messages, bu he won’ ha e his emo ional s a e classi ied as dep essi e because o he lack o in o ma-
ion in he ime. Fo his eason, his me hod p edic s he emo ional le els o an indi idual, allowing o
iden i y indi iduals wi h isk o u u e diseases.
In o de o p edic each basic emo ion o an au ho , he pipeline - as p esen ed in Fig. 30 - pe o ms
a sequence o 5 s eps o calcula e he emo ional s a e’s pe cen age acco ding o he ex s ecei ed.
Figu e 30: P edic Emo ionalLe els pipeline
These s eps a e:
1) The me hod ecei es he au ho id;
2) The Time Se ies pe sonal model is loaded;
3) The mos ecen las 12 weeks emo ions a e loaded om he da abase;
4) The emo ions a e p edic ed o he nex 4 weeks;
5) The in o ma ion is e u ned.
6.1.6.1 Inpu and ou pu da a o ma s
The
P edic Emo ionalLe els
me hod, ecei es a s uc u e 𝐴𝑢𝑡ℎ𝑜𝑟 (𝑠𝑜𝑢𝑟𝑐𝑒, 𝑖𝑑)as pa ame e o p edic
he use ’s u u e emo ional le els. In a o mal de ini ion, i ecei es:
𝐴𝑢𝑡ℎ𝑜𝑟 =(𝑠𝑜𝑢𝑟𝑐𝑒, 𝑖𝑑)
68
6.1. ARCHITECTURE
whe e:
𝑠𝑜𝑢𝑟𝑐𝑒 is he sou ce (Twi e , SMS, Wha sApp) om whe e he da a was inpu ed;
𝑖𝑑 is he au ho id ha he p edic ions e e s o.
An example o he
P edic Emo ionalLe els’s
eques is p esen ed below:
1{
2"sou ce" :"4",
3"id" :"3"
4}
The
P edic Emo ionalLe els’s
esponse e u ns a message in JSON o ma con aining he dis ibu ion
o each basic emo ion up o 4 weeks, as p esen ed below:
1{
2"Week1":{
3"Ange ":"0.15",
4"An icipa ion":"0.15",
5"Disgus ":"0.22",
6"Fea ":"0.14",
7"Joy":"0.06",
8"Sadness":"0.18",
9"Su p ise":"0.07",
10 "T us ":"0.07"
11 },
12 "Week2":{
13 "Ange ":"0.05",
14 "An icipa ion":"0.13",
15 "Disgus ":"0.26",
16 "Fea ":"0.13",
17 "Joy":"0.07",
18 "Sadness":"0.21",
19 "Su p ise":"0.08",
20 "T us ":"0.7"
21 },
22 "Week3":{
23 "Ange ":"0.12",
24 "An icipa ion":"0.17",
25 "Disgus ":"0.17",
26 "Fea ":"0.16",
69
CHAPTER 6. EMOTIONAL STATE CLASSIFIER
27 "Joy":"0.09",
28 "Sadness":"0.19",
29 "Su p ise":"0.02",
30 "T us ":"0.08"
31 },
32 "Week4":{
33 "Ange ":"0.08",
34 "An icipa ion":"0.10",
35 "Disgus ":"0.28",
36 "Fea ":"0.17",
37 "Joy":"0.08",
38 "Sadness":"0.16",
39 "Su p ise":"0.06",
40 "T us ":"0.07"
41 }
42 }
6.2 Tasks
Each me hod de ined in he Web API needs o in oke some asks o p oduce he esul s. He e is p esen ed
an o e iew abou hese asks.
The mos ele an asks used by he emo ional s a e classi ica ion sys em a e:
• Da a P epa a ion;
• Emo ional P o ile ;
• Vocabula y Pe sonalize ;
• Time Se ies Model Builde ;
• Classi ica ion Model Builde ;
• Reg ession Model Builde .
They will be desc ibed in he nex subsec ions.
70
6.2. TASKS
6.2.1 Da a P epa a ion
The objec i e o Da a P epa a ion is o p ep ocess he ex s ecei ed, educing he se o o iginal wo ds
o a se con aining only emo ional wo ds. This ask educes signi ican ly he size o he da ase o be
p ocessed.
In gene al, p ep ocessing is he i s s ep in NLP app oaches being used o ex ac ele an in o ma ion
om ex , ela ionships and o he use ul insigh s which he wo ds can ca y on.
Figu e 31: Da a P epa a ion pipeline
The Da a P epa a ion was idealized o pe o m a pipeline o clean he inpu ex p io o analyse i .
The pipeline, as p esen ed in Fig. 31, begins when he da a is ecei ed. In a o mal desc ip ion, he da a
ecei ed is a se 𝐷𝑇 o sen ences 𝑆𝑇 whe e:
𝐷𝑇 ={𝑠𝑡1,𝑠𝑡2, ...,𝑠𝑡𝑛},𝑛 >0
𝑆𝑇 ={𝑤1,𝑤2, ...,𝑤𝑘}, 𝑘 >0
𝑊𝑘is a wo d a posi ion 𝑘
The nex s ep in he pipeline sa es 𝐷𝑇 in he da abase o keep i s o iginal ex p io he p ocessing.
A he hi d s ep, all messages a e analysed o de ec known N-G ams (big ams and ig ams essen ially).
The objec i e o his s ep is a oid ha known exp essions (such as “be igh back”) wi h mo e han one
wo d be handled as a se o single wo ds. Th ough a lis o known exp essions, all messages a e analysed
in o de o iden i y he exis ence o a known exp ession. I iden i ied, he exp ession in he sen ence is
upda ed o i s “ng ammed” e sion.
Then, he sen ences a e analysed h ough a pa o speech agge . This p ocess iden i ies he g am-
ma ical ca ego ies o he wo ds con ained in a sen ence. The idea in his p ocess is o keep only nouns,
e bs, ad e bs and adjec i es. This is impo an because only hese g amma ical ca ego ies can b ing
emo ional in o ma ion. Mo eo e , his app oach helps o dec ease he p ocessing ime, because he s ep
o s opwo ds emo ing is no necessa y since he g amma ical ca ego y o he mos known s opwo ds a e
di e en han nouns, e bs, ad e bs and adjec i es used in his app oach.
La e , he emaining sen ences a e okenized, i.e., all sen ence is conside ed as an a ay o wo ds. Fo
each wo d in his a ay o wo ds, i lemma izes he wo d o a no malized o m. This p ocess uses lemma-
iza ion ins ead o s emming because he lexicon’s wo ds a e iden i ica ion is highe when compa ed o
s emming. So, his s ep is mo e impo an o us because i inc eases he a e o iden i ica ion o wo ds in
he emo ional lexicon.
71
Pa III
Case S udies
78

This pa p esen s some case s udies using emo ional in o ma ion, aiming a demons a ing di e en
eal applica ions o he emo ional s a e classi ica ion. This pa is a compila ion o pape s submi ed and
p esen ed in con e ences. Each chap e in his pa co esponds o one o hose pape s, howe e o a oid
epe i i e in o ma ion, he pape s we e no included di ec ly; hey we e sligh ly adap ed and he sec ions
ega ding o he s a e o he a and he app oach p oposed in his Ph.D. wo k we e emo ed, because
hei con en was p esen ed wi h mo e de ail in Pa I; also sugges ions o u u e wo k we e emo ed om
h las sec ion. Howe e , o keep he con ex and mo i a ion, o he app oach ollowed o deal wi h each
case s udy, i is possible ha some pa ag aphs may sound epe i i e.
The case s udies chosen and discussed in he nex chap e s aim a demons a e:
• How emo ional p o ile can di e en ia e people;
• How o c ea e and ep esen a pe sonal ocabula y and hei indi idual emo ions;
• How each one o us end o be a ac ed and c ea e good ela ionships wi h people wi h simila
emo ional p o iles;
• How he emo ions a ec he daily ou ines, and how o de ec and o ecas hem using ex s;
• How o use emo ions o p edic a popula ion’s beha iou ;
• How o use ex o classi y emo ional s a e indi idually.
7
Case S udy 1 - Use iden i ica ion by emo ional
p o ile
Since Ba ack Obama’s elec ion, he poli icians a e using social media o ha e a di ec con ac wi h hei
o e s and inc ease i s c edibili y wi h hei pos s and commen s. On he o he hand, his di ec channel
enables a co ec pe cep ion by he o e s abou he poli ics, c ea ing opinions abou he subjec s hey
conside impo an . This phenomenon is inc easingly u ning poli icians in o digi al in luence s. So, he
way as hey communica e in social media can be conside ed hei “pe sonal signa u e”; so hei wo ies
abou he way how hey can be in e p e ed a e equally impo an .
Wi h massi e in o ma ion om social media, he digi al in luence s and hei legion o ollowe s alida e,
ein o ce and ampli y news, many imes aked. As he main objec i e o hese indi iduals is be “liked,
lo ed and sha ed”, i is e y impo an o choose co ec ly he wo ds con ained in o hei ex s, in o de o
maximize he sen imen aised up in he eade s.
So, he emo ional cha ac e is ics con ained in he messages make up an “emo ional p o ile”abou he
au ho and which, along wi h he wo ds used in he ex , helps o de e mine he message’s au ho p o ile
while w i ing.
Fo example, he ollowing pos s a e om di e en au ho s and deal he same heme - he Pa is
Clima e Ag eemen - howe e , he w i ing s yles a e di e en and a ouse di e en emo ions. While he i s
balances posi i e and nega i e wo ds in he ex , he second mos ly uses wo ds wi h nega i e emo ions:
“Today ma ks a c ucial s ep o wa d in he igh agains clima e change, as he his o ic Pa is Clima e Ag ee-
men o icially en e s in o o ce. Le ’s keep pushing o p og ess”(Ba ack Obama);
“I’m op imis ic we can s op clima e change and help hose who a e being hu he mos by i —all while mee ing
he wo ld’s ene gy needs”(Bill Ga es).
In his case s udy, i is p esen ed an app oach using he au ho emo ional p o ile in o de o imp o e
he au ho ship iden i ica ion.
80
7.1. DATA ANALYSIS
7.1 Da a analysis
In o de o p edic he au ho s o a pos based on he emo ion con ained in ex , 2100 Facebook pos s we e
collec ed om 8 di e en au ho s o di e en a eas, as p esen ed in Table 9. All da a was collec ed a he
same ime span, educing empo al si ua ions in e e ence in he ex emo ions. In o de o compa e all
in o ma ion, he pos s we e manually labelled in o 2 ca ego ies: poli icians and non-poli icians.
Table 9: Pos s au ho s
Au ho A ea Ca ego y
Ba ack Obama Poli ics Poli ician
Bill Ga es Business Non-Poli ician
Donald T ump Business Non-Poli ician
Hilla y Clin on Poli ics Poli ician
Je emy Co byn Poli ics Poli ician
Leona do Di Cap io En e ainmen Non-Poli ician
Magic Johnson Spo s Non-Poli ician
The esa May Poli ics Poli ician
The ask o p edic he au ho o a ex is composed o se e al in e media es s eps. Fi s , i was
needed some p ep ocessing asks in o de o educe da a size by emo ing unnecessa y ex om he
o iginal message.
P ep ocessing is a e y impo an s ep in ex mining p ocesses and applica ions. I is he i s s ep
no only o ex mining app oaches bu also in da a mining. The e a e se e al p ep ocessing echniques
use ul in o de o ex ac in o ma ion om ex , and hei usage is acco ding o he cha ac e is ics o he
in o ma ion desi ed. Despi e o some echniques we e c ea ed in da a mining, hey a e use ul in ex mining
app oaches, since he same echnique can be used o bo h in o ma ion ex ac ion, in o ma ion e ie al,
o combined
The p ep ocessing, a e he okeniza ion, was di ided in 3 pa allel jobs, as showed in Fig. 37: Pa
o Speech Tagging (POS-T), Named En i y Recogni ion (NER) and S opwo ds Remo al. This s a egy was
used because bo h POS-T and NER need he ex in he o iginal o ma , in o de o e u n he co ec da a
om he analysis.
The POS-T p ocess iden i ies he ex g amma ical s uc u e. Conce ning ex cleaning, only nouns,
e bs, ad e bs and adjec i es we e p ese ed. This is impo an because only hese g amma ical ca e-
go ies can b ing emo ional in o ma ion. So, in a mo e o mal way, he Tokeniza ion p ocess con e s he
o iginal ex 𝐷in a se o okens 𝑇={𝑡1, 𝑡2, ..., 𝑡𝑛}whe e each elemen con ained in 𝑇is pa o he
o iginal documen D. La e , he POS-T labels each oken wi h a seman ic in o ma ion. La e , a p ocess
collec s all nouns, e bs, ad e bs and adjec i es in a se P, whe e 𝑃𝑇={𝑝(𝑇,1), 𝑝(𝑇,2), ..., 𝑝(𝑇,𝑘)}and 0
≤k≤n and 𝑃𝑇⊂𝑇.
81
CHAPTER 7. CASE STUDY 1 - USER IDENTIFICATION BY EMOTIONAL PROFILE
Figu e 37: P ep ocessing asks
Simila ly, NER p ocess iden i ies names in 3 di e en ca ego ies: “Loca ion”, “Pe son”and “O ga-
niza ion”. Once iden i ied okens in one o hese ca ego ies, hey a e emo ed. As a esul , a se
𝑁𝑇={𝑛(𝑇,1), 𝑛(𝑇,2), ..., 𝑛(𝑇,𝑗)}is cons uc ed based on iden i ied wo d ca ego y and whe e 0 ≤j≤
n and 𝑁𝑇⊂𝑇. This s ep is impo an o be done in pa allel wi h POS because some loca ions can be
con used wi h nouns (as Long Beach, o ins ance).
The S opwo ds lis is a pe sonal p ede ined se 𝑆𝑊 ={𝑠𝑤1, 𝑠𝑤2, ...𝑠𝑤𝑦}o wo ds, manually c ea ed
acco ding o se e al simila lis s a ailable on he in e ne .
A e he 3 p ep ocessing asks inish, he esul documen 𝑆𝑇 mus con ain a se o wo ds whe e
𝑆𝑇 =𝑇′∩𝑃𝑇∩𝑁𝑇.
La e , in his se 𝑆𝑇 is applied a s emming p ocess o educe he wo ds o hei wo d s em in o de o
conside all in lec ed wo ds as only one, p oducing he p ep ocessed ex 𝑃𝑅 ={𝑆𝑇1, 𝑆𝑇2, ..., 𝑆𝑇𝑧} eady
o be analysed.
Fo all h ee asks - POS-T, NER and Tokeniza ion - he S an o d Co e NLP [113] oolki was used.
An example using a eal pos om Ba ack Obama o ex p ep ocessing is p esen ed in Fig. 38.
7.2 Pola i y analysis
The i s analysis made was aimed a de e mining he pos s pola i ies. To achie e his objec i e, a e he
p ep ocessing, all sen ences con ained in 𝑃𝑅 we e compa ed agains EmoLex lexicon [133] in o de o
iden i y he posi i e and nega i e wo ds con ained in he ex . This analysis did no ake in o accoun he
in ensi y o he pola i ies nei he he emo ions.
When compa ing he pos s’ pola i ies acco ding o hei au ho ’s ca ego y (poli icians and non-poli icians),
he da a did no e eal ele an di e ences be ween poli ician and non-poli icians, as showed in he Fig.
39. The same analysis was con i med using he chi-squa ed es , whe e was ob ained a alue 𝜒2=1,
indica ing ha bo h pola i ies da a (poli icians and non-poli icians) a e no independen .
82
7.2. POLARITY ANALYSIS
Figu e 38: P ep ocessing ex example
Figu e 39: Pola i ies dis ibu ion by ca ego y
Howe e , his in e p e a ion may lead o a w ong unde s anding abou he scena io. When compa ing
he pola i ies by au ho , acco ding o Fig. 40, i is possible o conclude ha while poli icians end o ha e
hei pos s in he same a ea in a no mal dis ibu ion, non-poli icians ends o be in he ex emes, i.e., hey
a e blun e han poli icians when exp essing h ough Facebook and indica ing ha each au ho has i s own
“emo ional signa u e”in his pos s.
This in o ma ion is con i med in Table 10, which p esen s he posi i e and nega i e pola i ies by au ho .
83

CHAPTER 7. CASE STUDY 1 - USER IDENTIFICATION BY EMOTIONAL PROFILE
Figu e 40: Pola i ies dis ibu ion by au ho
Table 10: Pola i ies by au ho
Au ho Posi i e Nega i e
Ba ack Obama 0.28 0.13
Bill Ga es 0.30 0.11
Donald T ump 0.25 0.16
Hilla y Clin on 0.35 0.17
Je emy Co byn 0.30 0,13
Leona do Di Cap io 0.34 0.09
Magic Johnson 0.37 0.06
The esa May 0.36 0.10
7.3 Lexicon-based emo ion analysis
In o de o analyse he emo ions con ained in o he ex , i was used a lexicon-based app oach, which
consis s in compa ing he labelled emo ion con ained in o he EmoLex lexicon wi h he p ep ocessed ex s
desc ibed ea lie . Using he emo ions model p oposed by Plu chik [157], whe e all sen imen is composed
o a se o 8 basic emo ions (
ange
,
an icipa ion
,
disgus
,
ea
,
joy
,
sadness
,
su p ise
and
us
), all pos s
whe e analysed acco ding o his model and a lis o emo ions in each pos was gene a ed, acco ding o
Table 11.
Hence, when applying he Pe son’s co ela ion coe icien (𝑟2) be ween pola i ies and basic emo ions,
as p esen ed in Table 12, i is possible o poin which emo ions a e ela ed wi h pola i ies.
In a scale anging om -1 o 1, emo ions ela ed wi h a high 𝑟2 alue indica es a s ong ela ion
wi h he pola i y (as
Ange
and nega i e pola i y), while high nega i e 𝑟2 alues indica es a s ong in e se
ela ionship (as
Fea
and posi i e pola i y). In ou app oach, ambiguous emo ions a e classi ied when he
s anda d de ia ion o 𝑟2pola i y’s alue is less han 10% ange (i.e. 0.2).
84
7.4. MACHINE LEARNING-BASED EMOTION ANALYSIS
Table 11: Basic emo ions a e age pe au ho
Au ho Ange An icipa ion Disgus Fea Joy Sadness Su p ise T us
Ba ack Obama 0.08 0.15 0.03 0.10 0.13 0.05 0.05 0.21
Bill Ga es 0.06 0.14 0.04 0.08 0.15 0.06 0.06 0.14
Donald T ump 0.06 0.12 0.02 0.09 0.12 0.10 0.04 0.16
Hilla y Clin on 0.14 0.26 0.02 0.07 0.22 0.15 0.12 0.30
Je emy Co byn 0.08 0.16 0.03 0.08 0.09 0.08 0.06 0.23
Leona do Di Cap io 0.04 0.11 0.01 0.07 0.09 0.03 0.03 0.16
Magic Johnson 0.03 0.19 0.03 0.05 0.21 0.04 0.07 0.21
The esa May 0.06 0.17 0.02 0.06 0.14 0.07 0.07 0.22
Table 12: Co ela ion be ween pola i ies and emo ions
Pola i y Ange An icipa ion Disgus Fea Joy Sadness Su p ise T us
Posi i e -0.10 0.49 -0,26 -0.90 0.48 -0.22 0.44 0.40
Nega i e 0.83 0.27 -0,08 0.60 0.01 0.89 0.34 0.37
In summa y, posi i e and nega i e emo ions a e impo an o desc ibe he au ho ’s emo ional pa e n,
while he neu al emo ions do no ha e signi ican con ibu ion o achie e his objec i e. he emo ions
classi ied in ex acco ding o pola i ies a e:
• Posi i e pola i y - Joy;
• Nega i e pola i y - Ange , Fea , Sadness;
• Ambiguous pola i y - An icipa ion, Disgus , Su p ise, T us .
7.4 Machine lea ning-based emo ion analysis
Once iden i ied he a e age o each emo ion om au ho , he nex analysis was o iden i y he emo ional
pa e n o he au ho . To achie e his, i was used an app oach based on machine lea ning (ML) echniques.
The i s a emp was aimed a iden i ying he lowes p edic ion a e au ho . Fo his, i was used he same
messages wi h jus p ep ocessing and he au ho s iden i ica ion in a ML app oach. Once his in o ma ion
was ob ained only by ex s, his alue can be conside ed he lowes accep able alue, and, in case o
dec easing his a e, i may be in e p e ed as a nega i e in luence o emo ions in he au ho s p edic ion.
In ou ini ial es s, he bes a e was p esen ed by a SVM implemen a ion h ough Weka [67] and a
10- old c oss alida ion in he whole da ase , wi h a co ec p edic ion p ecision o 82% o when p edic ing
au ho s.
85
CHAPTER 7. CASE STUDY 1 - USER IDENTIFICATION BY EMOTIONAL PROFILE
When he lowes p edic ion a e was iden i ied, he nex s ep was o classi y using he emo ional
in o ma ion. Using he p e ious p ep ocessed ex s, pola i y alues and each basic emo ion a e, a new
da ase was gene a ed in o de o be used in ML p ocess. In ou es s, i was used he mos ele an
algo i hms o ex classi ica ion, as SVM, Nai e Bayes, Random Fo es s, howe e , using a Nai e Bayes
Mul inomial implemen a ion h ough Weka and a 10- old c oss alida ion in he whole da ase , e u ned a
p ecision o 87.41% o co ec p edic ions when p edic ing au ho s. Bo h esul s (non-p ep ocessed and
p ep ocessed) a e p esen ed in Table 13.
Table 13: De ailed accu acy esul s o non-p ep ocessed and p ep ocessed ex s
Non-p ep ocessed ex s P ep ocessed ex s
Au ho P ecision Recall F-Measu e P ecision Recall F-Measu e
Ba ack Obama 0.933 0.82 0.776 0.907 0.860 0.883
Bill Ga es 0.887 0.874 0.836 0.882 0.944 0.912
Donald T ump 0.317 0.465 0.518 0.761 0.556 0.642
Hilla y Clin on 0.571 0.686 0.693 0.676 0.762 0.716
Je emy Co byn 0.741 0.824 0.814 0.859 0.836 0.847
Leona do Di Cap io 0.807 0.782 0.734 0.878 0.876 0.877
Magic Johnson 0.867 0.893 0.867 0.945 0.917 0.931
The esa May 0.495 0.591 0.588 0.649 0.758 0.699
7.5 Conclusion
This case s udy p esen s a combina ion o lexicon-based and machine lea ning app oaches o explo e he
emo ions con ained in a ex h ough he bes p ac ices in sen imen analysis in o de o inc ease he
esul s’ accu acy in au ho ship iden i ica ion.
E e yone ha e pa icula cha ac e is ics o exp essing hemsel es, and hese pe sonal cha ac e is ics
can be exp essed in hei ex s.
Once he au ho ’s w i ing s yle p o ile is known, by using he emo ional in o ma ion con ained in o
ex helps o inc ease he accu acy on au ho ship iden i ica ion. This claiming is based on he success ul
p edic ions a e g own om 82% o 87.41% in ou es s, besides he alues o p ecision, ecall and -measu e
which ha e inc eased in he majo i y o he cases, when using emo ional labelled da a. This imp o emen
can be in e p e ed as a e y sa is ac o y esul as ou p oposal.
86
8
Case S udy 2 - Lexicon pe sonaliza ion
I is common in la ge coun ies ha people sha e known wo ds wi h di e en meanings. In Po ugal,
people om Lisbon o de a d a bee as “impe ial” while in Po o is “ ino”, howe e , in Lisbon “ ino” can
be a poli e pe son and in Po o “impe ial” is abou e e y hing ela ed o he Po uguese oyal y. These
wo ds, p onounced by people om di e en loca ions exp ess di e en emo ions, and on he o he hand,
hese emo ions exp ess he sen imen ha he au ho wan ed o ansmi when p onounced hem. So, i is
essen ial o know wha he au ho wan s o ansmi , in o de o a oid misunde s andings - commonplace
when we a el o di e en coun ies which speak he same language. I we do no know he au ho ’s
meaning o used wo ds in he ex , we p ima ily will “decode” he wo ds acco ding o ou comp ehension
o hem. So i could be a p oblem! In sen imen analysis, he same p oblem occu s when applying
emo ional lexicon o de ec he emo ions embedded in he ex . Once one o mo e pe sons c ea e he
emo ional lexicon, di e en emo ional in e p e a ion can be applied o he wo ds, and o he some o he
canno be p esen in he lexicon. So, de ec ing emo ions using an emo ional lexicon as suppo is like a
“pieces o di e en poin s o iew” ins ead o au ho ’s ision.
In his case s udy we p esen an app oach o c ea ing a pe sonal emo ional lexicon based on social
media messages, using Na u al Language P ocessing.
8.1 Rela ed wo k
Acco ding o Dic iona y.com, he e m lexicon is de ined as:
A. a wo dbook o dic iona y, especially o G eek, La in, o Heb ew;
B. he ocabula y o a pa icula language, ield, social class, pe son, e c.;
C. in en o y o eco d.
The e a e se e al wo ks o lexicon expansion o di e si ied objec i es, and some a e mo e ele an o
he p esen pape as hey ha e been used as a sou ce o he idea p oposed. In his sec ion, we su ey
hese inspi ing wo ks.
87
9
Case S udy 3 - Impac o emo ions in usual asks
In any kind o ela ionship, a golden ule o a oid p oblems is no aking decisions unde emo ional p essu e.
The e a e se e al s a egies o do his: om coun ing o en be o e esponding an unpolished message
un il aking a b eak o “ e esh he mind” be o e he decision.
Howe e , he e a e si ua ions, such as es s, whe e i is impossible o a oid emo ional p essu e and i s
consequences. When in a s ess ul si ua ion, o unde s ong emo ional condi ions, people end o make
mis akes mo e equen ly. This si ua ion happens in any p o ession, and so being able o p edic hese
e o s ha a e consequences o emo ional s a es is an impo an app oach o plan a s a egy o dec ease
o a oid hem. Fo example, how impo an would i be o anspo a ion companies o know he d i e s’
emo ional s a e be o e a elling, aiming o educe he isk o acciden s? How impo an would be o a
hospi al o p edic he e o s o a doc o , based on his emo ions?
E o s di e om p o ession o p o ession and also he e ec o emo ions o e he wo k is di e en .
Di e en da a se s mus be collec ed o iden i y hese e o s, and o co ela e hem wi h he emo ional
s a e o he wo ke .
As w i e s usually exp ess hei emo ions in he ex s hey p oduce h ough he bag o wo ds hey use
in each si ua ions, and he yping e o s hey do along an edi ing session ca be measu ed, we in end o
model he ela ion be ween emo ions and e o s, using he compu e as a case o s udy. The pu pose o
he s udy he e epo ed is o analyse a big collec ion o ex s anno a ed wi h edi ing da a o demons a e
ha he ela ion be ween e o s and emo ions can be iden i ied, and quan i ied in o de o p edic undesi ed
si ua ions.
In his pape , we p esen an app oach using Sen imen Analysis and Machine Lea ning o cha ac e ize
he impac o emo ions in he numbe o e o s du ing a yping p ocess. A e aining he model, i will be
used o p edic new cases in o de o assess i .
I is no ou in en ion o claim ha his app oach is an al e na i e o p edic ing e o s in all si ua ions,
howe e , we hink ha he app oach will lead u he u u e in es iga ion in his ele an opic.
94

9.1. THEORY OF BASIC EMOTIONS
9.1 Theo y o Basic Emo ions
Basic emo ion heo is s explain ha e e y human emo ion is composed o a se o disc e e basic emo ions
[36,80,156].
Many esea che s ha e iden i ied some basic uni e sal emo ions. One o he i s a emp s is a s udy
by [40] which concluded ha he e a e six basic emo ions a e
Dislike
,
Happiness
,
Sadness
,
Ange
,
Fea
and
Su p ise
. His wo k is based on he heo y ha human aces can ep esen his basic emo ion as
uni e sal pic u es.
Fo [156], e e y sen imen is composed o a se o 8 basic emo ions:
Ange
,
An icipa ion
,
Disgus
,
Fea
,
Joy
,
Sadness
,
Su p ise
and
T us
, ep esen ed as a “wheel o emo ions”. Fu he mo e, he combina ion o
basic emo ions esul s in
dyads
. Plu chik c ea ed ules o building he
dyads
, de ining he p ima y dyads
emo ions as he sum o wo adjacen basic emo ions, as
Op imism
=
An icipa ion
+
Joy
. Meanwhile,
seconda y dyads emo ions a e composed o emo ions ha a e one s ep apa on he “emo ion wheel”,
as
Unbelie
=
Su p ise
+
Disgus
. The e ia y emo ions a e gene a ed om emo ions ha a e wo s eps
apa on he wheel, as
Ou age
=
Su p ise
+
Ange
.
O he well-known emo ions model is he Fi e Fac o Model (as known as Big Fi e), in oduced by [124]
which sugges s ha he pe sonali y is composed o 5 independen ac o s:
A. Openness o expe ience - People wi h high sco es like news and end o be c ea i e. A he
o he end o he scale a e he con en ional and o de ly, hose who like he ou ine and ha e a keen
sense o igh and w ong;
B. Conscien iousness - I measu es he le el o concen a ion. Those wi h high sco es a e highly
mo i a ed, disciplined, commi ed and us wo hy. Those wi h low esul s a e undisciplined and
easily dis ac ed;
C. Ex o e sion - I measu es he sense o well-being, he le el o ene gy, and he abili y in in e pe -
sonal ela ionships. High sco es mean a abili y, sociabili y, and abili y o impose onesel . Lows
indica e in o e sion, ese a ion, and submission;
D. Ag eeableness - I e e s o how we ela e o o he s. Many poin s indica e a compassiona e,
iendly and wa m pe son. A he o he end a e he wi hd awn, c i ical and egocen ic;
E. Neu o icism - I measu es emo ional ins abili y. People wi h high sco es on his scale a e anxious,
inhibi ed, melancholic and ha e low sel -es eem. Those ha ge low sco es a e easy o deal wi h,
op imis ic and well-liked wi h hemsel es.
In his case s udy, we adop he Plu chik’s model o ep esen emo ions because we conside mo e
ealis ic, easy o use and his model allows o ep esen se e al di e en emo ions h ough dyads emo ion.
Mo eo e , he e a e some lib a ies and lexicons used in his wo k which ep esen and p ocess he emo ions
acco ding o his model.
95
CHAPTER 9. CASE STUDY 3 - IMPACT OF EMOTIONS IN USUAL TASKS
9.2 Rela ed wo k
The e a e se e al wo ks using sen imen analysis o di e si ied objec i es, and some a e mo e ele an
o he p esen pape as hey ha e been used as a sou ce o he idea p oposed. In his sec ion, we su ey
hese inspi ing wo ks. Howe e , p edic ing yping e o s om an emo ional analysis is an unexplo ed ield
and we ha e no ound speci ic p e ious wo ks o e e ence.
The usage o emo ional labels o p edic ions was inspi ed by he wo k o [118], which uses emo ional
labels o imp o e he au ho ship iden i ica ion. This is made using Facebook pos s om pe sonali ies
known and a hyb id app oach con aining lexicon and machine lea ning app oaches.
Mo eo e , [193] ha e p esen ed a wo k o ex ac sen imen s eng h om he in o mal English ex ,
using new me hods o exploi he de ac o g amma s and spelling s yles o cybe space, which con ibu ed
wi h he idea o ex ac sen imen pola i ies om ex .
Finally, he wo k p esen ed by [125] con ibu ed o he idea o p edic ing w i ing pe o mance using
a ec i e a iables o ela e o e icacy expec a ions.
9.3 Da a c ea ion
In o de o analyse he impac o he emo ions du ing he ex w i ing p ocess, i was necessa y o analyse
ex s con aining emo ional load and me a-in o ma ion abou i s c ea ion. Fo his pu pose, he da ase
p o ided by [10] con aining keys oke logs o opinion ex s abou gun con ol1was used as he basis o a
new da ase c ea ion. To pe o m he in ended analysis we ac ually needed a ex eposi o y wi h emo ional
load and edi ing nume ical da a o each w i en piece. The op ion o a keys oke log is jus i ied by he
necessi y o ga he in o ma ion abou he ex c ea ion p ocess. So, in ou s udy all ex s a e conside ed
w i en “ om beginning o end”, i.e., he i s yping s ep wi hou a pos e io ex e ision phase. This is
impo an o le elling possible e o s and edi ing in a same iden i iable pa e n.
The p ocess o he new da ase s c ea ion is pe o med in 2 s eps: Me a-in o ma ion C ea ion and
Emo ional Analysis, as p esen ed in Figu e 44.
Figu e 44: Da ase c ea ion p ocess
1This is a ho , sensible, opic p o oking emo i e eac ions on commen e s.
96
9.3. DATA CREATION
9.3.1 Me a-in o ma ion
The Me a-in o ma ion C ea ion s ep analyses he keys oke log and calcula es me ics abou he ex c e-
a ion. Fo analysis pu poses, we de ined some me ics conside ed impo an in his s udy. These me ics
a e:
•TimeTex - I ep esen s he ime spen du ing he ex w i ing. I is he amoun o ime span in
milliseconds be ween p ess and elease o each cha ac e and whi e space key in he keyboa d.
Punc ua ions, numbe s, and o he s a e disca ded;
•A e agePe Wo d - Is he a e age be ween he o al wo ds in he ex and he ime spen du ing
yping p ocess;
•Amoun E o s - I is he numbe o e o s du ing he yping p ocess. I is impo an o emphasize
ha due o da ase limi a ions ha do no s o e mouse mo emen s o selec ions, i is impossible
o de ec all o ms o emo ing cha ac e s ( o example, single cha ac e o block emo ing). Fo
con enience o his s udy, i is conside ed an
e o
each
backspace occu ence
2;
•A e ageE o s - I is he a e age o he o al wo ds in he ex and he numbe o e o s du ing
yping p ocess;
•TimeBe weenKeys - I is he a e age ime span be ween he keyboa d p ess;
•Repea edCha ac e F equence - I is he equency o a cha ac e is epea ed in he ex . A
epea ed cha ac e is conside ed he same cha ac e hose ha e been p essed immedia ely be o e
and he ime be ween hem is a leas 15% lowe han TimeBe weenKeys. This is impo an o de ec
si ua ions when a key is p essed o a long ime, epea ing he cha ac e .
9.3.2 Emo ional Analysis
The Emo ional Analysis s ep is esponsible o iden i ica ion o each basic emo ion acco ding o Plu chik’s
model [156]. This model was chosen because he e a e many lib a ies o p ocess in o ma ion acco ding
o i and lexicons which con ain he basic emo ions o each wo d. To achie e his objec i e, all sen ences
a e analysed using he EmoLex [133] lexicon.
Fo his analysis, all ex s ha e been submi ed o a p ep ocessing pipeline; a he end o his phase,
only he ele an in o ma ion emained.
This pipeline was composed o n-G am iden i ica ion, okeniza ion, s opwo ds emo al, pa o speech
agging and named en i y emo al, as p esen ed in Figu e 45.
2We a e awa e ha coun ing backspaces is no he mo e adequa e way o coun e o s, because o he easons can lead
he w i e o backspace and dele e cha ac e s, and also many e o s a e made wi hou being de ec ed and co ec ed. Anyway
we eel ha he e is a clea ela ion be ween bo h.
97
CHAPTER 9. CASE STUDY 3 - IMPACT OF EMOTIONS IN USUAL TASKS
Figu e 45: P ep ocessing pipeline
Using he S an o d Co e NLP oolki [113] o hese asks, he p ep ocessing is di ided in o 3 pa allel
asks. This is impo an because bo h Pa o Speech Tagging and Named En i y Recogni ion need he ex
in he o iginal o ma in o de o iden i y he in o ma ion.
The p ep ocessing begins wi h he N-G am iden i ica ion, whe e a p ede ined se o n-g ams a e iden-
i ied in he ex and labelled o be in e p e ed as a single wo d. La e , he okenize spli s he ex in a lis
o wo ds ( okens) and hese okens a e syn ac ically analysed in Pa o Speech, whe e he nouns, e bs,
ad e bs, and adjec i es a e iden i ied and s o ed o u u e pu poses. In pa allel, he okens iden i ied in
a p ede ined s opwo ds lis a e emo ed and he okens in named en i y p ocess a e analysed in o de o
iden i y names (pe sons, loca ions o o ganiza ions) and disca d hem.
La e , he common okens in hese p ocesses a e s o ed and he emo ions om each p ep ocessed
ex a e iden i ied h ough a p ocess in R which que ies he EmoLex lexicon [133] and iden i ies he basic
emo ions using he Syuzhe package [84].
Finally, all in o ma ion is s o ed in a new da ase con aining he opinion and p ep ocessed ex ( om he
o iginal da ase ), he 6 me ics c ea ed in Me a-In o ma ion C ea ion s ep, 8 basic emo ions pe cen ages
and 2 pola i ies iden i ied in he Emo ional Analysis s ep.
9.4 Da a analysis
The objec i e o his analysis is o ind some e idence ha emo ions in luence he w i ing p ocess. In o de
o achie e his objec i e, some expe imen s we e pe o med o ela e emo ions and w i ing pa e ns.
9.4.1 Emo ional co ela ions
As ini ial s ep, he alues o some Plu chik’s basic emo ions and de ined dyad emo ions [156] we e
calcula ed in o de o p o ide mo e sou ces o in o ma ion o analyse he da a. To calcula e hese emo ions,
98
9.4. DATA ANALYSIS
we used he package Syuzhe in R, which analyses he ex p o ided and e u ns he alues o each basic
emo ion con ained in o he ex , acco ding o he EmoLex lexicon [133]. The dyad emo ions we e calcula ed
acco ding o he o mula below:
• Op imism = An icipa ion + Joy;
• Disapp o al = Su p ise + Sadness;
• Hope = An icipa ion + T us ;
• Unbelie = Su p ise + Disgus ;
• Anxie y = An icipa ion + Fea ;
• Ou age = Su p ise + Ange ;
• Lo e = Joy + T us ;
• Remo se = Sadness + Disgus ;
• Guil = Joy + Fea ;
• Deligh = Joy + Su p ise;
• Pessimism = Sadness + An icipa ion;
• Cu iosi y = T us + Su p ise;
• Awe = Fea + Su p ise;
• Despai = Fea + Sadness;
• P ide = Ange + Joy;
• Shame = Fea + Disgus ;
La e , he Pea son co ela ion (𝑟2) was applied o bo h each basic emo ion and dyad emo ions, o
ob aining he co ela ion be ween he numbe o backspaces in he w i ing p ocess3(
Amoun E o s
as
p esen ed in subsec ion 9.3.1) and he emo ions, acco ding o Table 17.
Table 17: Co ela ions be ween
Amoun E o s
and emo ions
Emo ion 𝑟2Emo ion 𝑟2Emo ion 𝑟2Emo ion 𝑟2
Ange 0.35 Op imism 0.30 Pessimism 0.42 T us 0.36
An icipa ion 0.31 Hope 0.39 Awe 0.38 Cu iosi y 0.37
Disgus 0.26 Anxie y 0.52 Despai 0.38 P ide 0.38
Fea 0.38 Lo e 0.35 Shame 0.38 Su p ise 0.19
Joy 0.23 Guil 0.41 Disapp o al 0.30 Remo se 0.31
Sadness 0.30 Deligh 0.25 Unbelie 0.27 Ou age 0.34
Despi e no single emo ion ha ing a s ong co ela ion, i is possible o iden i y ha among all emo ions
analysed, anxie y is he mos ele an o he numbe o e o s du ing yping, ha ing a mode a e co ela ion.
9.4.2 Machine lea ning p edic ions
A machine lea ning analysis was applied o de e mine he in luence o he me a-in o ma ion and emo ional
labels on he numbe o e o s p edic ion. Fo his pu pose, 5 di e en scena ios we e conside ed:
• Scena io A - Only ex and opinion - no me a-in o ma ion nei he emo ional labels;
• Scena io B - Only me a-in o ma ion and emo ional labels;
3Remembe ha we a e using his measu e o compu e he e o s numbe .
99

CHAPTER 9. CASE STUDY 3 - IMPACT OF EMOTIONS IN USUAL TASKS
• Scena io C - Only me a-in o ma ion;
• Scena io D - Only emo ional labels;
• Scena io E - All da ase in o ma ion - ex , opinion, me a-in o ma ion and emo ional labels.
The da ase used o bo h aining and alida ion is he same c ea ed in subsec ion 9.3.2. In his
analysis, he me a-in o ma ion
A e ageE o s
was disca ded because i has s ong co ela ion wi h
Amoun-
E o s
, induced by
Amoun E o s
≈
A e ageE o s
∗
TimeTex
.
Fo each scena io, he ollowing machine lea ning algo i hms we e applied: Linea Reg ession, SVM,
Random Fo es and Decision Table.
All es s we e pe o med using a 10- old c oss- alida ion in Weka; he co ela ion coe icien s ob ained
wi h each algo i hm be ween Amoun E o s and he dimensions analysed in each scena io a e shown in
Table 18.
Table 18: Algo i hms co ela ions and hei Roo Mean Squa ed E o (RMSE)
Scena io Linea
Reg ession RMSE SVM RMSE Random
Fo es RMSE Decision
Table RMSE
Scena io A 0.171 391.28 0.347 208.62 0.429 145.36 0.321 104.78
Scena io B 0.774 99.62 0.769 103.32 0.791 96.67 0.739 106.37
Scena io C 0.777 99.14 0.770 103.08 0.780 98.66 0.739 106.37
Scena io D 0.525 134.10 0.528 137.73 0.492 141.70 0.426 143.54
Scena io E 0.320 437.12 0.696 131.79 0.586 127.88 0.591 129.18
A e he es s, he bes co ela ion coe icien o p edic ing he numbe o e o s was ob ained wi h
he Random Fo es algo i hm o Scena io B (only me a-in o ma ion and emo ional labels).
Once iden i ied ha he me a-in o ma ion and emo ional labels a e an adequa e o p edic he numbe
o e o s, he nex s ep was o iden i y he pa e ns o hese p edic ions. Fo his pu pose, all alues
we e disc e ized in o 4 g oups and a K-Means algo i hm was used o clus e he da a (me a-in o ma ion
and emo ional labels) in o 4 di e en clus e s ep esen ing espec i ely 39%, 17%, 23% and 21% o he
in o ma ion a ailable.
In a p elimina y analysis, all me a-in o ma ion was iden i ied wi h he same alue ange, and o his
eason, i was conside ed i ele an o his objec i e and emo ed om he isualiza ion. Also, as he
pu pose o his analysis is o measu e he emo ional in luence in he
Amoun E o s
alues, he dimen-
sions
Posi i e
and
Nega i e
we e emo ed oo. Then he ele an in o ma ion emaining was g ouped by
Amoun E o s
and is p esen ed in Table 19, whe e he ange in
Amoun E os
e e s o he numbe o e o s
iden i ied, while he ange o each emo ion e e s o he numbe o wo ds con aining he emo ion in he
ex .
Ha ing in mind he esul s in Table 19, i is possible o conclude ha in gene al, as highe he emo ions
a e, highe is he impac on he
Amoun E o s
numbe .
100
9.5. CONCLUSION
Table 19: Ranges o
Amoun E o s
pe emo ions
Emo ions
Amoun E o s Ange An icipa ion Disgus Fea Joy Sadness Su p ise T us
0.0-204.5 2.5-3.5 0.5-1.5 0.5-1.5 0.0-4.5 0.0-0.5 0.0-1.5 0.0-0.5 2.5-4.5
204.5-256.5 3.5-5.5 1.5-2.5 0.0-0.5 5.5-7.5 1.5-2.5 2.5-3.5 0.5-1.5 4.5-∞
256.5-340 3.5-5.5 0.5-1.5 1.5-2.5 5.5-7.5 0.5-1.5 3.5-∞0.0-1 2.5-4.5
340-∞5.5-∞2.5-∞2.5-∞7.5-∞2.5-∞3.5-∞2.5-∞4.5-∞
9.5 Conclusion
A ypis ce ainly will ha e ewe e o s han a no mal pe son when yping. Howe e , e en his ypis will
do mo e mis akes i he is, o ins ance, anxious o eeling guil y.
As a i s s ep in a esea ch di ec ion we wan o u he explo e —
he sen imen analysis in di e en
asks o unde s and he e ec o he wo ke ’s emo ional s a e on his pe o mance, o educe mis akes
— his pape p esen s a combina ion o lexicon-based and machine lea ning app oaches o co ela e he
numbe o yping e o s based on he emo ional labels and me ics associa ed wi h he ex c ea ion ( ex
i s yping/edi ing). Tha model can be used o p edic e o s based on he in o ma ion o he emo ional
s a e; in his way we will ha e a igo ous c i e ion o ecommend people o s op doing some ask unde
some pe sonal s a es o a oid dange ous aul s.
E e yone has pa icula cha ac e is ics o exp essing himsel and hese pe sonal cha ac e is ics can
o cou se in luence ha p edic ion. Maybe on accoun o ha , he s udy esul s so a ob ained we e
a bi su p ising, and he measu ed in luence o emo ions on use s endency o make mis akes is
mod-
e a e
(we we e expec ing bigge alues). In ou es s, he bes app oaches o p edic ing e o s based
on human beha iou we e ob ained using emo ional in o ma ion (emo ions in e ed om he ex lexical
analysis)and me a-in o ma ion (me ics e alua ed based on he ex c ea ion p ocess) collec ed du ing ex
yping. Clus e ing he da a e ealed how he emo ions can a ec he numbe o e o s. I is a p omising
esul .
101
10
Case s udy 4 - De e mining emo ional p o iles
based in ex ual analysis
P obably, one o he well known and used p o e bs is: “Bi ds o a ea he , lock oge he ”. Howe e , wha
does i mean? In gene al meaning, i e e s ha people wi h common ai s, in e es s and as es end o
associa e and ela e wi h each o he , in he same way as bi ds o he same species lock oge he . I can be
obse ed in se e al di e en human beha iou s, whe e people wi h common pe sonali ies end o ela e
o each o he .
Psychodynamic esea che s claim ha pe sonali y s uc u e is se in childhood. Fo [175], he indi id-
ual pe sonali y is o med a ound 2 o 3 yea s old, mos ly h ough child aining p ac ices. [55] a gues ha
when he Oedipal complex is esol ed, all basic s uc u es o pe sonali y - he id, ego, and supe ego - a e
ully de eloped in opposi ion o [42] and [108], which belie e ha pe sonali y con inues o de elop la e in
li e. Sha ing he same ision o E ikson and Loe inge , he mo i a ional speake [166] claimed ha “you
a e he a e age o he i e people you spend he mos ime wi h”.
Th ough social media usage - in gene al mic oblogging - people (au ho s) can exp ess hei opinion,
desi es and hough s o a b oad audience - om iends o unknown ollowe s - keeping p oximi y despi e
physical dis ance. Howe e , is his audience in e es ed in he au ho ’s pos s because hey sha e he same
sen imen , mood o emo ions? Also, since so wa e has no childhood, nei he id, ego, and supe ego, is i
possible o c ea e an emo ional p o ile based on exis ing ones, enabling he so wa e “lea n” how o ha e
a pe sonali y?
In his case s udy, we p esen an app oach o emo ional p o ile c ea ion based on exis en emo ional
p o iles, using emo ion-based analysis o de e mine he p oximi y o he au ho ’s emo ional and g amma -
ical w i ing s yle wi h hei audience on mic oblogging.
10.1 Emo ion heo ies
In he li e a u e, he e a e se e al models ha a emp o explain he eme gence o emo ions and hei
associa ed beha iou s. The main esea ch heo ies he e su eyed o se e as backg ound o ou analy ical
wo k a e disc e e, dimensional and app aisal heo ies.
102
10.2. RELATED WORK
Disc e e emo ional heo ies p opose he exis ence o basic emo ions ha a e uni e sally displayed
and ecognized, g ouped in o ca ego ies and independen . An example o disc e e emo ional heo y is
p oposed by [157], whe e all sen imen is composed o a se o 8 basic emo ions (
ange
,
an icipa ion
,
disgus
,
ea
,
joy
,
sadness
,
su p ise
and
us
).
On he o he hand, dimensional heo ies cha ac e ize emo ions ega ding wo o h ee dimensions,
gene ally “a ousal” and “ alence.” Valence is ela ed o a posi i e o nega i e e alua ion and is associa ed
wi h he eeling s a e o pleasu e ( s displeasu e). A ousal e lec s he gene al deg ee o in ensi y el .
Howe e , using his wo-dimensional is con using o di e en emo ions ha sha e he same alues o
alence and a ousal, as
ange
and
ea
. Fo his eason, i is common o add a hi d dimension o suppo
his di e en ia ion, as in ensi y. Acco ding o [101] “ he hi d iew emphasises he dis inc componen o
emo ions, and is o en e med he componen ial iew.”
Emo ional-cogni i e psychologis s ocus hei s udies mainly on he app aisal p ocess. Acco ding o
[179], he cen al idea is ha emo ions a e igge ed and di e en ia ed by subjec i e analysis o an e en ,
si ua ion o objec . Fo ins ance, Bill and Mike a e wa ching a oo ball game whe e hei eams a e playing.
Bill’s a ou i e eam wins (e en ). Mike’s app aisal is ha an undesi able e en happened. Fo Bill, he
app aisal is ha he e en is desi able. So, he same e en has p oduced opposi e app aisals. In ac ,
emo ions a e igge ed by he pe sonal in e p e a ion o he annoying o chee ul aspec s o an e en , he
app aisal.
10.2 Rela ed wo k
Due o he ex ensi e usage, sen imen analysis on mic oblogs can be conside ed an opinion- ich esou ce
and has been gaining popula i y and a ac ing esea che s om o he a eas o co ela e in o ma ion abou
speci ic e en s (e.g. Ch is mas, oo ball ma ches, elec ions) wi h he sen imen con ained in pos s.
To pe o m sen imen analysis on mic oblogging, acco ding o [150], a s aigh o wa d app oach is o
exploi adi ional sen imen analysis models. Howe e , such me hods a e ine icien because hey igno e
some unique cha ac e is ics o mic oblog’s da a, as emo icons ep esen a ions. Mo eo e , he e a e lo s o
colloquial e ms, abb e ia ions and misspel wo ds used in mic oblogs which leads o hea y p ep ocessing
asks in o de o iden i y i s occu ences and “ ansla e” hem o a canonical o m o be in e p e ed co ec ly.
Due o such p ope ies, se e al models ha e been de eloped especially o mic oblogs sen imen analysis
ecen ly.
An example o co ela ions be ween e en s and sen imen s was p oposed by [75], which measu es he
sen imen s on Twi e du ing a pe iod and compa es he co ela ion be ween sen imen s con ained in he
ex and signi ican e en s, including he s ock ma ke , elec ions and Thanksgi ing. Also, [91] examined a
da ase con aining wee s abou Michael Jackson’s dea h in o de o analyse how emo ion is exp essed on
Twi e . [141] ha e analysed he sen imen s abou poli icians, de ec ing a s ong co ela ion be ween he
agg ega ed sen imen and manually collec ed poll a ings.
103
CHAPTER 10. CASE STUDY 4 - DETERMINING EMOTIONAL PROFILES BASED IN TEXTUAL ANALYSIS
las 1000 wee s o he same audiences used be o e, in o de o iden i y he simila i y be ween hei ex s.
Table 28: Simila i ies be ween au ho s and audiences
Audiences
Au ho (1) (2) (3) (4) (5) (6) Mean S anda d De ia ion
Elon Musk (1) 0,681% 0,605% 0,629% 0,650% 0,542% 0,536% 0,607% 0,058%
Donald T ump (2) 0,728% 1,068% 0,840% 0,833% 0,893% 0,687% 0,842% 0,135%
Ka y Pe y (3) 0,712% 0,613% 0,999% 0,811% 0,623% 1,096% 0,809% 0,201%
Alan Shipnuck (4) 0,553% 0,531% 0,738% 0,664% 0,557% 0,573% 0,603% 0,081%
Michele Daube (5) 0,739% 0,745% 0,731% 0,824% 0,926% 0,672% 0,773% 0,089%
Floyd Maywhea he (6) 0,605% 0,542% 0,846% 0,566% 0,473% 1,430% 0,744% 0,360%
Be o e analysing he ex s, hey we e p ep ocessed using he same pipeline desc ibed in Sec ion 10.3.1
in o de o keep he ex s in he same s uc u e in o he di e en analysis.
Using he Jacca d dis ance as me ic o analyse he simila i y among he ex s; ini ially, we analysed
he simila i y be ween each au ho ’s ex s and he ex s o all audiences, in o de o iden i y which audience
is mo e simila o he au ho . Once iden i ied he ex ’s simila i y pe cen age, we calcula ed he a e age
o each audience, acco ding o he o mula:
Í𝑛
𝑖=1𝑆𝑀1𝑖+Í𝑛
𝑖=1𝑆𝑀2𝑖+Í𝑛
𝑖=1𝑆𝑀3𝑖+Í𝑛
𝑖=1𝑆𝑀4𝑖+Í𝑛
𝑖=1𝑆𝑀5𝑖
𝑛
La e , o each au ho , we calcula ed he mean and s anda d de ia ion o he simila i y be ween him
and he audiences, as p esen ed in Table 28.
This in o ma ion allowed o iden i y ha , in mos cases, he highes simila i y a e age was be ween he
au ho and his audience. Mo eo e , he cases whe e i did no occu , he simila i ies alues o he au ho ’s
audience added wi h s anda d de ia ion indica es ha he audience’s alue is close o he highes alue.
10.4 Conclusion
This pape p esen ed an analysis o he emo ional and g amma ical w i ing s yles simila i y om au ho s
and hei mos equen audiences on mic oblogs. This app oach used lexicon-based echniques o explo e
he emo ions con ained in wee s and NLP echniques o iden i y g amma ical exce p s.
Once he emo ional and g amma ical w i ing s yles ha e e y high alues, indica ing a s ong co ela-
ion be ween au ho s and audiences, i is possible o conclude ha bo h au ho s and audiences sha e he
same w i ing s yle. Mo eo e , he co ela ion be ween au ho s emo ions and he mos equen audiences
emo ions exhibi ed in Fig. 47 is high, and as he size o his audience inc eases, he lowe he co ela ion
becomes, con i ming Jim Rohn’s claiming.
This is a c ucial issue because i enables he possibili y o cha bo s o c ea e an emo ional p o ile
based on he in e ac ions ecei ed om people o e en o he sys ems, c ea ing an iden i y and in e ac ing
wi h he end use in smoo h communica ion. Combining Gene a i e Ad e sa ial Ne wo ks (GANs) and
emo ional p o iles, a new gene a ion o cha bo s can c ea e i s own “pe sonali y” and gene a e ex ual
esponses ha i i s emo ional p o ile.
110

11
Case S udy 5 - P edic ion o elec ion esul s
acco ding o emo ional analysis
I is undeniable ha social media ha e changed how people con ac o each o he , enabling hem o
main ain ela ionships ha p e iously would be di icul o main ain o a ious easons, such as dis ance,
he passage o ime, and misunde s andings.
Ba ack Obama used social media as he main pla o m o his p esiden ial campaign in he Uni ed
S a es in 2008, and since hen, i is well es ablished ha social media c ea ed a s ong in luence on
o e s’ decisions in ha elec ion and many o he s. Facebook and Twi e a e now conside ed essen ial
ools o any poli ical campaign, along wi h o he social media pla o ms ha ha e been c ea ed since hen.
The in luence o social media inc eases when candida es wi h low unding le els and low le els o
adi ional media exposu e y o de ea ad e sa ies wi h mo e esou ces. Social media allow he candida es
o pos hei poli ical pla o ms as well as in lamma o y pos s agains hei opponen s. In many cases,
poli ical candida es use social media mainly o ca y p o oca i e a acks agains hei opponen s. Thei
ollowe s, in u n, use social media o b oadcas hei eac ions o ange and sa is ac ion in pos s ha can
be sha ed housands o imes.
In elec o al campaigns highly ma ked by hei massi e p esence on social ne wo ks - as was he B azil-
ian p esiden ial elec ion in 2018 – by using Na u al Language P ocessing (NLP) and Machine Lea ning
(ML) i is possible o iden i y wha o e s hink and eel abou he candida es and hei p oposals o he
a ious a eas o he go e nmen . Thus, some in e es ing esea ch ques ion ha a ises a e: ”How do he
emo ions abou each candida e in luence he elec o al decision?”and ”Is i possible o p edic he esul
o an elec ion only by knowing wha o e s “ eel” abou a candida e?”
In his case s udy, we p esen an app oach o p edic he esul s o he elec ion. As a case s udy, we
collec ed messages om social media abou he B azilian p esiden ial elec ion o 2018, whe e we used
Sen imen Analysis, NLP and ML o iden i y which emo ions domina ed he elec o a e and hei co ela ions
wi h he numbe o messages abou he candida es and inally p edic he esul s.
111
CHAPTER 11. CASE STUDY 5 - PREDICTION OF ELECTION RESULTS ACCORDING TO EMOTIONAL ANALYSIS
11.1 Rela ed wo k
The analysis o emo ions on Twi e o explain elec ions is no a new app oach. Se e al esea che s ha e
al eady done wo k in his a ea, each wi h di e en app oaches and esul s. [201] de eloped a sys em o
analyze he wee s abou p esiden ial candida es in he 2012 U.S. elec ion as exp essed on Twi e . His
app oach analyzes he ex ’s pola i ies (posi i e, neu al o nega i e), he olume o pos s and he wo d
mos used. This is he same app oach used by [72], ha ained a Con olu ional Neu al Ne wo k using
an anno a ed lexicon - Sen imen 140 - o de ec he ex ’s pola i ies.
These app oaches do no go deepe on he easons o pola i ies, and hus, does no iden i y which
sen imen s in luence he o e s’ decision, which is he objec i e o ou wo k.
[195] has de eloped an analysis o wee s o he Ge man elec ions which, simila o Wang’s wo k,
used he pola i ies o ph ases o analyze he messages. Howe e , unlike he p e ious wo k, Tumasjan’s
s udy ela es he olume o messages o he inal esul o he elec ion. This app oach is highly in luenced
by inancial ques ions (as iche he candida e is, mo e publici y abou him can be pos ed in social media),
and o his eason, we did no conside us wo hy. [13] used his same app oach, using he da a om
he I ish gene al elec ion o 2011, bu , di e en han Tumasjan, he has expanded he model o aining by
using polls as pa ame e s o aining he p edic ions, which has inspi ed ou wo k in he aining da ase
c ea ion.
While he exis ing wo ks ocused only on he aspec o he ex ’s pola i ies, he wo k o [121] inspi ed
ou decision o conside he basic emo ions con ained in he ex as a ac o o in luence in he decision
o he o e , and use i o p edic esul s.
11.2 Da ase c ea ion
Ini ially, o d aw om he da a a gene al idea o he B azilian o e , i would be necessa y o gene alize he
emo ional p o ile o hese o e s, ega dless o hei egion. The idea is ha , acco ding o he emo ions
con ained in he ex s, i would be possible o de e mine ele an in o ma ion abou he cha ac e is ics o
he B azilian o e s. Thus, a pipeline was c ea ed o da ase c ea ion, as p esen ed in Fig. 48.
This pipeline begins wi h a collec ion o messages abou he candida es. Fo his pu pose, we collec ed
wee s om 145 ci ies in B azil, wi h each s a e being ep esen ed by a leas i s ou la ges ci ies, and
delimi ing a adius o 30 km o each ci y. The op ion o geoloca ed wee s is o a oid pos s om coun ies
di e en han B azil, whe e he au ho p obably would be no able o o e in B azilian’s elec ion. To
selec wha would be conside ed ele an o no , we de ined ha only he wee s con aining he main
candida es’ names would be collec ed. Twee s con aining wo o mo e candida es’ names we e analyzed
o all candida es men ioned in he ex . Mo eo e , we conside ed ele an only wee s - no e wee s. This
decision was inspi ed by he necessi y o a oid i al pos s o he ones om digi al in luence s. In o he
wo ds, we wan ed o know he opinion om he message’s au ho abou a candida e, no he opinion o
an au ho who he au ho likes.
112
11.2. DATASET CREATION
Figu e 48: Da ase ’s c ea ion pipeline
Fo ga he ing he wee s, we de eloped a sc ip in Py hon using he o icial API p o ided by Twi e ,
and collec ed all geoloca ed messages om he 145 ci ies men ioned ea lie in he pe iod om May
2018 o Oc obe 2018, which con ained a leas one o he ollowing names in hei ex s: “Bolsona o”,
“Ci o Gomes”, “Ma ina Sil a”, “Alckmin”, “Amoêdo”, “Ál a o Dias”, “Boulos”, “Mei elles”and “Haddad”,
di ided in wo g oups: i s ound and second ound.
11.2.1 Ou o scope
A e an ini ial analysis o he messages collec ed, we decided no o handle he ambigui y in he ex s
du ing he analysis. The eason o choosing no o add ess his p oblem was jus i ied by he iny amoun
o messages ha could lead o e oneous in e p e a ions. Since i was a manda o y equi emen o he
messages o con ain he name o a leas one candida e, he na u e o he Twi e messages - which limi s
each pos by 280 cha ac e s - al eady conside ably inhibi ed his ype o p oblem.
Fu he mo e, his ini ial analysis showed ha he exis ence o he candida e’s name in he ex made
he con ex o he message as poli ical and egali a ian in he emo ional sense, as de oga o y nicknames
o he leading candida e candida es b ing nega i e emo ions. So, we a oided ha exace ba ed emo ional
exp essions o some candida es a ec o he s.
11.2.2 Lexicon expansion
When wo king wi h sen imen analysis, a common app oach is o use a dic iona y-based algo i hm o
iden i y he emo ional wo ds in ex s. Howe e , acco ding o Feldman [49], “ he main disad an age o any
dic iona y-based algo i hm is ha he acqui ed lexicon is domain-independen and hence does no cap u e
he speci ic peculia i ies o any speci ic domain.”Thus, i is essen ial o know some pa icula i ies abou
he domain which he ex s ep esen , o a oid misunde s andings and enable analys s o make a be e
classi ica ion o he sen imen s con ained in he ex s.
Wi h his p oblem in mind, we adap ed he solu ion p esen ed by Ma ins [119], whe e he ex s we e
ep esen ed by a ec o o wo ds and hese ec o s we e used o analyze he simila i ies o he wo ds
113
CHAPTER 11. CASE STUDY 5 - PREDICTION OF ELECTION RESULTS ACCORDING TO EMOTIONAL ANALYSIS
con ained in an emo ional lexicon, o expand i . A majo conce n when c ea ing hese ec o s was abou
he pola iza ion among he candida es. Ou idea was ha he ex s abou a candida e do no in luence
he emo ional wo ds o o he candida es. Fo his eason, we adop ed he s a egy o c ea ing a pe sonal
emo ional lexicon o each candida e and hus analyzing he candida e’s sen imen s indi idually acco ding
o hei espec i e emo ional lexicon.
Figu e 49: Lexicon expansion p ocess
An o e iew o he en i e p ocess o lexicon expansion is p esen ed in Fig. 49.
11.2.2.1 Wo d Vec o s
The p ocess o lexicon expansion begins wi h g ouping all wee s collec ed by he candida e’s name, e-
mo ing hei s opwo ds and c ea ing he wo d ec o s. Fo his pu pose, we de eloped a sc ip in Py hon
using he Wo d2Vec algo i hm, p esen ed by Mikolo [128], ha ing as pa ame e s: size o 50; window
5 and ained o 200 epochs. La e , he emo ional lexicon is in oduced, o eed he wo d ec o s wi h
emo ional seed wo ds. Fo his s ep, we used he EmoLex lexicon [133] o p o ide he emo ional wo ds o
he wo d ec o s. The eason o his lexicon’s choice is ha i p o ides emo ional wo ds in Po uguese and
also con ains indica ions o pola i ies (posi i e and nega i e) and anno a ions o he eigh basic emo ions
acco ding o Plu chik’s heo y [157], which de ines sen imen s as
ange , an icipa ion, disgus , ea , joy,
sadness, su p ise
and
us
.
Each wo d in he emo ional lexicon was analyzed in he wo d ec o o each candida e, o iden i y
simila i ies. Fo all simila wo ds ound wi h a alue highe han 0.7, hese wo ds inhe i ed he emo ional
alues om he lexicon’s wo d and - ecu si ely - we e analyzed in he wo d ec o o sea ch o new
simila i ies. Fo each simila wo d ound in he wo d ec o s, we added his wo d in a “new emo ional
lexicon”con aining he o iginal emo ional lexicon and hei espec i e simila i ies and emo ional anno a ions
acco ding o he wo d ec o s.
An impo an issue o emphasize in his app oach is ha when inishing he c ea ion o his lexicon, we
ha e a con ex ual emo ional lexicon, because con ex ual wo ds and i s simila i ies we e used in i s c ea ion.
This con ex is p o ided because all messages con ain a leas one candida e’s names. Thus, he con ex
o he lexicon is abou poli ics.
114
11.2. DATASET CREATION
11.2.2.2 Resul s
When he lexicon expansion p ocess was inished, he esul was a se o pe sonal lexicons abou poli ics,
con aining he basic lexicon da a inc eased by simila i ies ound in he ex and he synonyms o he wo ds.
The cha ac e is ics o each pe sonal lexicon a e p esen ed in Table 29. Due o space limi a ion, Table 29
only p esen s he op 5 mos known poli icians, bu in ou s udy, all poli icians ha we e candida e we e
conside ed in his analysis.
Table 29: Cha ac e is ics o he pe sonal lexicon c ea ed
Lexicon Wo ds Ange An icipa ion Disgus Fea Joy Sadness Su p ise T us Posi i e Nega i e
O iginal Lexicon 13911 8,85% 5,92% 7,48% 10,44% 4,88% 8,46% 3,76% 8,72% 16,36% 23,47%
Ge aldo Alckmin 15251 8,89% 5,91% 7,50% 10,39% 4,82% 8,45% 3,79% 9,14% 16,56% 23,45%
Jai Bolsona o 22082 9,16% 5,73% 7,63% 10,50% 5,01% 9,24% 3,38% 10,10% 17,49% 24,11%
Ci o Gomes 15316 8,95% 6,00% 7,47% 10,31% 4,99% 8,65% 3,77% 9,11% 16,78% 23,50%
Fe nando Haddad 18264 9,27% 5,70% 7,47% 10,65% 4,87% 8,67% 3,46% 9,19% 17,26% 23,37%
Ma ina Sil a 14842 8,76% 5,88% 7,40% 10,37% 4,85% 8,44% 3,76% 8,79% 16,38% 23,32%
11.2.3 P ep ocessing
A e c ea ing a pe sonal lexicon o each candida e, he nex s ep consis ed o c ea ing a ex p ep ocessing
pipeline o emo e unnecessa y in o ma ion om he ex s. This pipeline, as p esen ed in Fig. 50, begins
wi h okeniza ion, which con e s he ex s in o a lis o single wo ds, o
okens
. Then, he p ocess is di ided
in o wo pa allel asks: Pa o Speech Tagging (POS-T) and S opwo ds Remo al. The POS-T p ocess is
esponsible o iden i ying g amma ical pieces o in o ma ion o each wo d in he ex , such as adjec i es,
ad e bs and nouns, while he S opwo d Remo al emo es any occu ence in he ex o a de ined wo d o
lis o wo ds.
This s a egy o pa alleling POS-T and S opwo ds emo al was used because POS-T needs he ex in
he o iginal o ma , o classi y he wo ds in hei espec i e g amma ical ca ego ies co ec ly.
Figu e 50: P ep ocessing asks
Conce ning ex cleaning, in POS-T, e e y wo d in a g amma ical ca ego y o he han noun, e b,
ad e b o adjec i e is disca ded. This is impo an because only hese g amma ical ca ego ies ca y
emo ional in o ma ion ha can be used in u he s eps. So, mo e o mally, he okeniza ion p ocess
115

CHAPTER 11. CASE STUDY 5 - PREDICTION OF ELECTION RESULTS ACCORDING TO EMOTIONAL ANALYSIS
con e s he o iginal ex 𝐷in a se o okens 𝑇={𝑡1, 𝑡2, ..., 𝑡𝑛}whe e each elemen con ained in 𝑇
is pa o he o iginal documen D. These okens will eed he POS-T, which will label each oken wi h
seman ic in o ma ion. Finally all nouns, e bs, ad e bs and adjec i es will be collec ed in a se P, whe e
𝑃𝑡={𝑝(𝑡,1), 𝑝(𝑡,2), ..., 𝑝(𝑡,𝑘)}and 0 ≤k≤n and 𝑃𝑡⊂𝑇.
The S opwo ds lis is a manual and p ede ined se 𝑆𝑊 ={𝑠𝑤1, 𝑠𝑤2, ...𝑠𝑤𝑦}o wo ds, in ended o
a oid he analysis o common and i ele an wo ds. The e a e many examples o S opwo ds lis s on he
in e ne and in lib a ies o Na u al Language P ocessing (NLP). In ou app oach, a e he S opwo ds
Remo ing p ocess, he esul lis is a se 𝑁=𝑇−𝑆𝑊 .
A e he pa allel p ep ocessing asks inish, he esul documen 𝑆𝑇 mus con ain a se o wo ds
whe e 𝑆𝑇 =𝑃∩𝑁.
La e , in 𝐿𝑀 a lemma ize p ocess educes he wo ds o hei lemma. This s ep is impo an be-
cause allows conside ing all in lec ed wo ds as only one, p oducing he se o p ep ocessed ex s 𝑃𝑅 =
{𝐿𝑀 (𝑆𝑇1), 𝐿𝑀(𝑆𝑇2), ..., 𝐿𝑀(𝑆𝑇𝑧)}.
The inal esul o his pipeline is a new emo ional lexicon ha conside s he simila i ies o wo ds used
in exp essions ha ci e he candida es, and hei synonyms, and ha is a pe sonal ep esen a ion o he
sen imen s abou each candida e.
Fo his p ep ocessing s ep, we de eloped a Py hon module using Spacy1 o au oma izing he Tok-
eniza ion, POS-T, S opwo ds Remo al and Lemma iza ion p ocesses. We chose o use his oolki in he
de elopmen because i p o ides suppo o B azilian Po uguese in all s eps desc ibed ea lie .
11.2.4 Sen imen Analysis
Once we c ea ed new pe sonal lexicons o all candida es, he nex s ep in he da ase c ea ion was o
analyze he emo ions con ained in he ex s abou each candida e.
Fo his pu pose, we de eloped a ool ha coun s he equency o each emo ional wo d in a ex . The
esul o his analysis is he inal da ase , con aining he emo ional analysis o each Twi e message o
each candida e, on a scale om 0 o 100 o each Plu chik’s p ima y emo ion.
This app oach - a bag-o -wo d app oach - was adop ed because we in ended o iden i y which emo-
ions we e mo e ele an o he o e s when deciding hei candida e, besides o gene a e a “candida e
inge p in ” h ough he wo ds used o desc ibe hem. Mo eo e , he absence o emo ional co po a abou
poli ics in Po uguese es ic ed he possibili y o using o he echniques o iden i y he emo ions in ou
ex s.
11.3 Da a analysis
Once he da ase was c ea ed, we a emp ed o use da a analysis o iden i y some pa icula i ies abou he
da a, and how hese pa icula i ies could explain he esul s o he elec ions. We used se e al echniques
1h ps://spacy.io/
116
11.3. DATA ANALYSIS
o iden i y co ela ions be ween he esul s o he elec ions and he da a analyzed.
Once we iden i ied he emo ions ha in luenced he i s - ound esul s and how hey did so, he nex
objec i e was o p edic he esul s o he second ound. To each his objec i e, we decided o use
an app oach based on machine lea ning. The goal o his app oach was o ain a model ha could
accu a ely p edic he pe cen age o o es o each candida e based on he emo ions p e iously iden i ied,
he pe cen age o o es cas o each candida e in he i s ound, and he emo ions con ained in wee s
on he day o he second- ound o e.
11.3.1 T aining da ase
Du ing he c ea ion o a da ase o aining he model, an impo an issue was iden i ied: how o “ ans-
la e” he emo ions in o a pe cen age o o es. Once he i s ound esul s we e known, he ela ionship
be ween candida es’ emo ional p o iles and he pe cen age o o es cas on ha day could also be de-
e mined. Howe e , i was necessa y o ob ain many mo e examples o ain a model. To bypass his
obs acle, we chose o use he public in o ma ion on elec o al polls a ailable om public ins i u es. The
chosen ins i u es we e: Ins i u o B asilei o de Opinião e Pesquisa (Ibope) 2, Ins i u o Da a olha 3, Vox
Populi 4and Pa aná Pesquisas 5which a e he mos impo an polling ins i u es in B azil.
To c ea e he aining da ase , we collec ed he o ing in en ion esul s o 42 polls o candida es ha
we had in he da ase , which esul ed in 324 examples o aining, wi h 107,039.52 wee s analyzed.
La e , knowing he pe iod o each poll, we analyzed he a e age o each basic emo ion o each candida e
in he same pe iod om he da abase. We hen ans e ed hese emo ions o a new ile, indica ing he
candida e’s name, he numbe o candida es in he poll, pe iod, emo ions, and ins i u e.
Despi e he numbe o Twee s messages o each candida e a e di e en , his new da ase con ains
each candida e’s g ouped emo ions du ing he pe iod o each poll. Thus, all candida es had he same
numbe o egis e s in he da ase . This app oach ensu ed ha he mos ci ed candida es in messages
did no bias he da ase .
11.3.2 P edic ing esul s
A e c ea ing he aining da ase , he nex s ep was o ain a model o p edic ing he esul s o he
second ound. Fo his pu pose, we analyzed i e di e en machine lea ning algo i hms, o iden i y he
bes co ela ion be ween da a and esul s. In all cases, he da ase was sepa a ed 70% o aining and
30% o es ing, using he Mean Absolu e E o (MAE) as e o s s anda d measu e o ha e a compa ison
basis be ween adi ional pools and wi e Sen imen Analysis.
2h p://www.ibope.com.b
3h p://da a olha. olha.uol.com.b /
4h p://www. oxpopuli.com.b
5h p://www.pa anapesquisas.com.b /
117
CHAPTER 11. CASE STUDY 5 - PREDICTION OF ELECTION RESULTS ACCORDING TO EMOTIONAL ANALYSIS
The algo i hms (using implemen a ions o R and all uned o he bes i ) chosen o he analysis and
hei esul s a e aining he models a e p esen ed in Table 30.
Table 30: Algo i hms e alua ion
Algo i hm Co ela ion MAE
Simple Linea Reg ession 0,2639 10,6302
SVM 0,3677 9,3608
Decision Table 0,5385 9,226
Ex eme G adien Boos 0,9096 0,9787
Random Fo es 0,8088 6,322
The bes esul was ob ained by an Ex eme G adien Boos algo i hm, which had a co ela ion o
0,9096 ( e y s ong co ela ion) be ween he esul s in he polls and he emo ions in he same pe iod, and
a mean a e age e o o 0,9787.
Once he model was c ea ed, he goal was o p edic he pe cen age o o es o each candida e in he
second ound. In ou expe imen , we decided o p edic he alues based only on he emo ions exp essed
on he day o second- ound o ing un il 17:00. This ime limi a ion is because o e s could o e only
un il 17:00. Vo e s made hei decisions based on hei emo ions du ing he o ing p ocess. The e o e,
emo ions ha we e exp essed be o e he second- ound elec ion day we e no c ucial in his analysis.
A e collec ing he wee s o each second- ound candida e - Jai Bolsona o and Fe nando Haddad -
on Oc obe 20 and analyzing wee s abou hem using he same p ocess p esen ed in sec ion 11.2.3, we
go he alues p esen ed in Table 31.
Table 31: Emo ions in second ound’s day
Candida e Ange An icipa ion Disgus Fea Joy Sadness Su p ise T us
Jai Bolsona o 13,14% 11,14% 8,18% 12,71% 12,55% 14,80% 6,97% 20,50%
Fe nando Haddad 12,39% 13,50% 6,41% 10,67% 14,95% 14,22% 7,57% 20,29%
When applying hese alues o he model c ea ed p e iously, we go a p edic ion o 54,58% o Jai
Bolsona o and 43,98% o Fe nando Haddad and 0,9787% o MAE ha can be conside ed as a
co ec p e ision because he o icial esul s o he second ound we e 55,15% o Jai Bolsona o and
44,87% o Fe nando Haddad, whose alues a e in he accep ed e o ma gin.
11.4 Conclusion
Social media ha e changed he way people in e ac and exp ess hei hough s abou e e y hing. Because
o his changing eali y and he as quan i y o da a a ailable, sen imen analysis is becoming a powe ul,
as , and ela i ely inexpensi e ool ha is ex emely use ul o analyzing many di e en ypes o scena ios
and p edic ing u u e esul s.
118
11.4. CONCLUSION
Fu he mo e, al hough he e ha e been many s udies abou he in luence o social media on elec ions,
he e a e no app oaches using sen imen analysis o iden i y o e s’ emo ions and p edic u u e elec ion
esul s, while aking in o accoun he esul s o p e ious s udies.
The co ela ion be ween o e s’ emo ions and he pe cen age o o es shows how i al is o know he
audience’s sen imen s o plan e ec i e s a egies o in e ac ing wi h hem. Mo eo e , he e y s ong
co ela ions ha we ound be ween he basic emo ions and poll esul s’, as well ou model’s success ul
p edic ion o he second- ound esul s o B azilians elec ions, s ongly sugges ha sen imen analysis can
become a iable and eliable al e na i e o adi ional opinion polls, wi h he ad an ages o being much
as e and less expensi e.
Howe e , i is impo an o emphasize ha he e a e no s udies ye published abou wha he accep able
h eshold is o eplacing adi ional polls wi h sen imen analysis. Also, i has no ye been es ablished how
many wee s mus be analysed o eplace a adi ional opinion poll wi h a su icien deg ee o ce ain y.
119
CHAPTER 12. CASE STUDY 6 - DEPRESSION CLASSIFICATION BASED SOCIAL MEDIA ANALYSIS
Figu e 54: Ou lie s iden i ica ion
Table 33: Co ela ion be ween dep essi e s a us and in ensi ies
In ensi ies
Ange Fea Joy Sadness
0.49 0.49 -0.43 0.41
12.3.2 Clus e ing analysis
The objec i e o he Clus e ing Analysis is o pe o m da a ans o ma ions o unde s and i and how he
da a can be g ouped. To achie e his, he ini ial s ep was o ans o m he 12-dimension da ase in o
a 2-dimension da ase o isualizing he da a as a sca e plo , and his would be impossible using 12-
dimension da a.
Ini ially, we pe o med a P incipal Componen Analysis (PCA) o educe he da ase (wi h no in o ma-
ion abou dep essi e classi ica ion) dimensionali y. The PCA algo i hm iden i ied ha he mos ele an
dimensions in he da ase we e
Fea
and
Disgus
, which can con ain 72.33% o he in o ma ion.
126

12.3. DATA ANALYSIS
Nex , he da ase esul an om PCA analysis ed he KMeans algo i hm used o clus e in o 2 ca e-
go ies he da a and gene a ed a sca e plo . The esul an g aphic is p esen ed in Figu e 55.
Figu e 55: Clus e s o in o ma ion
This in o ma ion is impo an because i shows ha he emo ional da a abou dep essi e and non-
dep essi e can be di ided in o 2 dis inc ca ego ies, and isually dis an .
12.3.3 Machine and Deep Lea ning analysis
The nex analysis consis ed in he c ea ion o a classi ica ion model able o iden i y he dep essi e emo ional
p o ile in messages. To achie e his objec i e, we used he da ase c ea ed in sec ion 12.2.4 in se e al
Machine Lea ning and Deep Lea ning algo i hms, aiming o iden i y he bes model o classi y dep ession.
Some cha ac e is ics om he p oblem (dep ession classi ica ion) and he da ase - as ew examples -
we e ele an in he choice o he algo i hms analysed. Algo i hms like LDA (Linea Disc iminan Analysis)
and Fishe Linea Disc iminan we e disca ded because we belie e ha he p oblem is no ep esen ed
by a linea unc ion. Fu he mo e, due o he ew da a o aining, Machine Lea ning algo i hms based
on neu al ne wo ks and boos ing we e no conside ed because hey end o ha e a be e pe o mance
when using a big amoun o da a. Howe e , we analysed hese ne wo k models, h ough a Dense Neu al
Ne wo k (DNN) and Con olu ional Neu al Ne wo k (CNN) using a Deep Lea ning app oach.
127
CHAPTER 12. CASE STUDY 6 - DEPRESSION CLASSIFICATION BASED SOCIAL MEDIA ANALYSIS
So, in ou analysis we e conside ed he ollowing algo i hms: Suppo Vec o Machines (SVM), Random
Fo es s, Nai e Bayes, DNN and CNN. In ou analysis we jus conside ed he algo i hm’s esul s a e a
uning p ocess, i.e., each algo i hm p esen s i s be e esul s using he bes pa ame e s. Fo he Deep
Lea ning models, we c ea ed se e al di e en model a chi ec u es o e alua e he be e esul s. Fo DNN,
he a chi ec u e whose go he bes accu acy was a 5- ie neu al model, ha ing a d opou o 0.5 be ween
each ie o a oid o e i ing, espec i ely. Rega ding CNN a chi ec u es, he mos accu a e was a 5- ie
1-D Con olu ional Neu al Ne wo k, using he same s a egy o d opou 0.5 on each ie o a oid o e i ing.
The accu acy and mean squa ed e o o each algo i hm and ne wo k a chi ec u e is p esen ed in
Table 34.
Table 34: Benchma k o Machine and Deep Lea ning algo i hms
Algo i hm Accu acy Mean Squa ed E o
SVM 0.984 0.126
Random Fo es 0.8 0.176
Nai e Bayes 0.76 0.45
DNN 0.939 0.076
CNN 0.915 0.071
These esul s show ha some Machine Lea ning algo i hms such as SVM and Deep Lea ning algo-
i hms as DNN can iden i y he dep essi e emo ional pa e n wi h good accu acy. These esul s a e be e
han he esul s obse ed in Sec ion 12.1, ein o cing ha he emo ional ex analysis o iden i y dep essi es
can be a p omising al e na i e o help people ha a e su e ing silen ly.
12.4 Conclusion
Day a e day, dep ession is becoming an epidemic disease ha a ec s people o di e en social le els,
cul u es and e hnici ies. Due o he na u e o silence, iden i ying people who ask o help because o his
illness bu canno e balize ha eques is qui e complica ed, and o en goes unno iced e en by he pe son
su e ing om dep ession.
The use o ex ual sen imen analysis can help iden i y he disease as i is a nonin asi e me hod ha
can be con inuously moni o ed. This is a huge help in he wa agains dep ession because i enables us
o iden i y pe iods o wellness and sadness wi hou a necessi y o isi a psychologis , enabling a quick
ac ion when necessa y.
Despi e many wo ks in his esea ch a ea, he esul s ob ained o his app oach a e p omising when
compa ed o he p e ious e o s, p incipally when he accu acy o 0.984 on dep ession classi ica ion is
p esen ed. Howe e , once he in o ma ion was da a collec ed om social media, we canno disca d he
hypo hesis o biased da a, because i is no possible o assu e ha he au ho s we e ue when w i ing
hei pos s.
128
Pa IV
Summa y, Con ibu ions and Fu u e Wo k
129
13
Conclusion
One o he main cha ac e is ics ha di e en ia e Human Being om o he species in he animal kingdom
is his abili y o ansmi his knowledge o e ime. Man has always used he elemen s a ound him o exp ess
his en i onmen , whe he in d awings made in ca es housands yea s ago, in hie oglyphics as in ancien
Egyp , o using he exis ing alphabe s. O e ime, di e en ways o communica ing we e s uc u ed and
hus he di e en languages (such as La in, Cop ic, and Ancien G eek) eme ged, which in u n e ol ed
and ga e ise o o he languages, wi h di e en ex ual ep esen a ions, such as Hindi, Kandi, Cy illic, La in,
G eek and A abic (among se e al o he languages), being used oday by people o e all he wo ld s ill wi h
he same pu pose o he ca eman: o ansmi knowledge.
Th ough his knowledge ansmi ed o e ime, we we e able o lea n abou he people’s li e and hei
belie s, cus oms, ea s and joys. We lea n abou Home ’s Odyssey om he G eeks, abou he eachings
con ained in he Heb ew Bible h ough he Dead Sea Sc olls, abou he une al i uals o he ancien
Egyp ians in he ombs o he pha aohs.
Howe e , when lea ning h ough eading, he eade will ine i ably be subjec o he poin o iew o
he au ho o he ex , which is somewha dange ous when i comes o ake news. To illus a e his poin o
iew, a he ime o w i ing he au ho ies o ec ea e he whole scena io so ha he in o ma ion is mo e
easily unde s ood by he eade h ough language, using wo ds o desc ibe he ac s, emo ions and senses
in which he is eeling o ying o con ey. Thus, when w i ing a ex , he au ho ansmi s his emo ions in
his p ocess.
Changing o he p esen , people ha e ne e p oduced so many ex s as oday. We a e su ounded
by ex ual in o ma ion ha come om websi es, blogs, social media, e c. Mo eo e , he social ela ions
became mo e physically dis an - e en mo e in pandemic imes - bu close due o he use o apps such
as Wha sApp. And he bigges pa o hese communica ion is done by ex .
So, hese ex s can be a aluable sou ce o in o ma ion o iden i y wha people a e eeling and classi y
hei emo ional s a e acco ding o hei emo ions exp essed in ex s.
Obse ing he basic emo ions model (namely he Plu chik’s model), whe e each indi idual has a se
o 8 basic and uni e sal emo ions, when iden i ying he equency o use o hese emo ional wo ds, i was
possible o d aw a emo ional p o ile o each au ho .
130
13.1. RESEARCH QUESTIONS & RESULTS AND CONTRIBUTIONS
Some issues we e aken in o accoun du ing his wo k in ela ion o he e ec i eness o his emo ional
p o ile o classi y he emo ional s a e. Fi s , i was necessa y o know whe he h ough he use o his
p o ile i would be possible o di e en ia e people (in his case, using ex s by hei espec i e au ho s).
Once he e ec i eness o he emo ional p o ile o di e en ia ing people was e i ied, i was necessa y o
imp o e he model o iden i ying emo ional wo ds, as each au ho has di e en emo ional cha ac e is ics,
he e o e, i would no be possible o conside ha he same wo d had he same emo ional cha ge o all.
Then, we iden i ied ha he a ini y be ween people is also iden i ied h ough emo ional p o iles.
Th ough he emo ional p o ile, we iden i ied ha i was possible o p edic people’s beha iou s, such
as hei impac s on daily ac i i ies and decisions aken unde emo ional con ex .
Finally, in he las s ep, we analysed a se o messages om people wi h dep ession oge he wi h a
se o people who did no ha e he disease. Th ough he use o Machine Lea ning and all s eps p e iously
de eloped, a model was c ea ed capable o lea ning he emo ional p o ile o a dep essed pe son, and hus
classi ying hei emo ional s a e based only on ex analysis.
13.1 Resea ch ques ions & Resul s and con ibu ions
Rega ding he main objec i e ha guided his PhD esea ch, which was o c ea e a classi ie o iden i y an
au ho ’s emo ional s a e om a se o ex s o his au ho ship, in Sec ion 1.2 we e p esen ed some esea ch
ques ions ha a e e isi ed and analysed he e:
•Do emo ional labels impac on he accu acy o classi ica ions?
Yes. The use o emo ional labels in machine lea ning models inc eased he accu acy o classi i-
ca ion, as demons a ed in he Chap e s 7,10 and 12, showing ha his in o ma ion is use ul o
de ec he emo ional s a e. To achie e his conclusion, i was ep oduced expe imen s using as
baselines he esul s ob ained om classi ica ions wi h no emo ional labels. La e , he expe imen s
we e edone conside ing he emo ional labels and bo h esul s we e compa ed;
•Is he e an abs ac model able o ep esen emo ional in o ma ion om a pe sonal
pe spec i e?
Yes. The combina ion o he 8 basic emo ions in a no malized dis ibu ion - he emo ional p o ile
- demons a ed ha i is possible o be conside ed as a pe sonal ep esen a ion o he au ho ’s
emo ional cha ac e is ics, being used o ep esen hem, as demons a ed in he Chap e s 7,8
and 10. This emo ional p o ile is a se o 8 basic emo ions acco ding o Plu chik’s model, whe e
each emo ion is in a ange o 0 and 1 and he sum o all 8 emo ions is 1. The emo ional p o ile
ep esen s he au ho ’s emo ional cha ac e is ics exp essed in hei ex s and is di e en om an
au ho o o he s.
•Based on he emo ional s a e o a pe son, would be possible o p edic his ac ions o
choices?
131

CHAPTER 13. CONCLUSION
Yes. I was iden i ied ha people ha sha e simila emo ional p o ile end o do simila e o s and
a i udes, as demons a ed in Chap e 9and 11. I was possible because people end o be epe i i e
in hei habi s and ou ines. The s udy o p edic ac ions was based on he numbe s o yping e o s
when an au ho ypes abou an emo ional opic. I was conside ed he emo ions con ained in he
ex s and he numbe o e o s was co ela ed wi h emo ions, b inging some in e es ing esul s. The
p edic ion o choices was s udied when c ea ing an emo ional p o ile o each candida e in B azilian’s
elec ions using pos s in Twi e , and making a eg ession o p edic he pe cen age o o es.
•Th ough emo ional in o ma ion, is he e a co ela ion be ween pe sonal w i ing s yle
and emo ional s a e?
Yes. The analysis o he w i ing s yle - he emo ions con ained in he ocabula y used by he au ho
and he g amma ical cha ac e is ics o he ex - ha e a high co ela ion wi h he emo ional s a e o
he au ho , as demons a ed in Chap e 10 and 12. This was possible because he au ho exp esses
hei emo ions in hei ex s, like a inge p in . Th ough he emo ional p o ile iden i ied in ex s, is
was possible o c ea e a classi ie o iden i y dep essi e p o iles - i.e. au ho s ha ha e dep ession -
and apply his classi ie o iden i y i a new emo ional p o ile o an au ho is ega ding a dep essi e
o no .
Fo hese ques ions, he de elopmen o his PhD esea ch ollowed some s eps, which we e po ayed
in he case s udies.
By s udying he way in which an au ho usually exp esses himsel , i is possible o iden i y in his ex s
pe sonali y ai s ha e lec his way o being. In his ligh , we compa ed he wo ds equen ly used by a
gi en au ho wi h an emo ional lexicon (unde he p emise ha he au ho was no masking his emo ions),
enabling he iden i ica ion o he mos equen ly used emo ional wo ds.
Based on he ini ial objec i es and he achie ed esul s, he main con ibu ion o his PhD wo k is an
app oach o classi y he emo ional s a e based on ex messages.
13.2 Publica ions
Du ing his PhD wo k, he e we e published some p elimina y e o s which con ibu ed o his wo k. The
publica ions ha ou come om his doc o al wo k a e lis ed below:
•
De e mining Emo ional P o ile Based on Mic oblogging Analysis
- P oposal o an app oach o de ine
he emo ional p o ile based on ex messages.
Ma ins R., Hen iques P., No ais P. (2019) De e mining Emo ional P o ile Based on Mic oblogging
Analysis. In: Mou a Oli ei a P., No ais P., Reis, L. P. (eds) 19 h EPIA Con e ence on A i icial
In elligence. EPIA 2019, Sp inge - P og ess in A i icial In elligence, Pa 2, ISBN 978-3-030-30244-
3, pp 159-171, 2019. h ps://doi.o g/10.1007/978-3-030-30244-3_14. SCImago SJR IF (2019)
0.65 (Q2 - A i icial In elligence), Indexed: Scopus;
132
13.2. PUBLICATIONS
•
A sen imen analysis app oach o inc ease au ho ship iden i ica ion
and
Ha e Speech Classi ica ion
in Social Media Using Emo ional Analysis
- P oposal o an app oach using emo ional in o ma ion o
imp o e classi ica ions.
Ma ins R., Almeida J.J., Hen iques P., No ais P., A sen imen analysis app oach o inc ease au-
ho ship iden i ica ion. Expe Sys ems, WILEY-BLACKWELL, Special Issue. ISSN 0266-4720, 2019.
h ps://doi.o g/10.1111/exsy.12469. ISI JCR (2017) IF: 1,430 (Q2 - COMPUTER SCIENCE, THE-
ORY & METHODS). SCImago SJR (2017) IF: 0,429 (Q2 - A i icial In elligence)
Ma ins R., Gomes M., Almeida J. J., No ais P., Hen iques P. (2018), Ha e Speech Classi ica ion in
Social Media Using Emo ional Analysis. 7 h B azilian Con e ence on In elligen Sys ems. BRACIS
2018, IEEE - P oceedings - 2018 B azilian Con e ence on In elligen Sys ems, BRACIS 2018, pp 61-
66, 2018. h ps://doi.o g/10.1109/BRACIS.2018.00019. SCImago SJR IF (2020) 0.22, Indexed:
IEEE;
•
C ea ing a social media-based pe sonal emo ional lexicon
- P oposal o a ool o expansion o
emo ional lexicons.
Ma ins R., Almeida J. J., No ais P., Hen iques P. (2018), C ea ing a Social Media-based Pe sonal
Emo ional Lexicon. 24 h B azilian Symposium on Mul imedia and he Web. WebMedia 2018, ACM
- P oceedings o he 24 h B azilian Symposium on Mul imedia and he Web, pp 261-264, 2018.
h p://doi.acm.o g/10.1145/3243082.3264668. SCImago SJR IF (2020) 0.12, Indexed: ACM;
•
Domain Iden i ica ion Th ough Sen imen Analysis
- P oposal o an app oach o iden i y he con ex
whe e a con e sa ion occu s, based on emo ional analysis.
Ma ins R., Almeida J. J., Hen iques P., No ais P. (2018) Domain Iden i ica ion Th ough Sen imen
Analysis. In: De La P ie a F., Oma u S., Fe nández-Caballe o A. (eds) 15 h In e na ional Symposium
on Dis ibu ed Compu ing and A i icial In elligence. DCAI 2018, Sp inge - Ad ances in In elligen
Sys ems and Compu ing, olume 800, ISSN 2194-5357, pp 276-283, 2018. h ps://doi.o g/10.1007/978-
3-319-94649-8_33. SCImago SJR IF (2018) 0.174 (Q3 - Compu e Science), Indexed: Scopus;
•
P edic ing Pe o mance P oblems Th ough Emo ional Analysis
- P oposal o an app oach o p edic
p oblems based on ex analysis and emo ional analysis.
Ma ins R., Almeida J. J., Hen iques P., No ais P. (2018), P edic ing Pe o mance P oblems Th ough
Emo ional Analysis (sho pape ). In: Hen iques P., Leal P., Lei ão A. M., Guino a X. G. (eds)
7 h Symposium on Languages, Applica ions and Technologies. SLATE 2018, Schloss Dags uhl–
Leibniz-Zen um ue In o ma ik, OpenAccess Se ies in In o ma ics (OASIcs), olume 62, ISBN 978-
3-95977-072-9, pp 19:1-19:9, 2018. h ps://doi.o g/10.4230/OASIcs.SLATE.2018.19, SCImago
SJR IF (2018) 0.206, Indexed: DBLP;
133
CHAPTER 13. CONCLUSION
•
P edic ing an Elec ion’s Ou come Using Sen imen Analysis
- An app oach o p edic g oup decisions
based on emo ional analysis.
Ma ins R., Almeida J. J., Hen iques P., No ais P. (2020) P edic ing an Elec ion's Ou come Using
Sen imen Analysis. In: Rocha A., Adeli H., Reis, L. P., Cos anzo S., O o ic I., Mo ei a F. (eds) 8 h
Wo ld Con e ence on In o ma ion Sys ems and Technologies. Wo ldCis 2020, Sp inge - Ad ances
in In elligen Sys ems and Compu ing, olume 1159, ISBN 978-3-030-45688-7, pp 134-143, 2020.
h ps://doi.o g/10.1007/978-3-030-45688-7_14. SCImago SJR IF (2019) 0.184 (Q3 - Compu e
Science), Indexed: Scopus;
•
Iden i ying Dep ession Clues using Emo ions and AI
- A case o s udy abou emo ional s a e iden i-
ica ion using emo ional in o ma ion.
Ma ins R., Almeida J. J., Hen iques P., No ais P. (2021) Iden i ying Dep ession Clues using Emo-
ions and AI. In: Rocha A. P., S eels L., He ik H. J. (eds) 13 h In e na ional Con e ence on Agen s
and A i icial In elligence. ICAART 2021, SciTeP ess - P oceedings o he 13 h In e na ional Con e -
ence on Agen s and A i icial In elligence, olume 2, ISBN 978-989-758-484-8, pp 1137-1143, 2021.
h ps://doi.o g/10.5220/0010332811371143. SCImago SJR IF (2020) 0.13, Indexed: Scopus;
13.3 Fu u e Wo k
Since he app oach he e p oposed o iden i y emo ional s a es is a o ally non-in asi e echnique, i allows
he c ea ion o a sys em o
moni o
people a isk, such as dep essi e c ises, panic a acks o anxie y, as
i can be associa ed wi h he ools ha su ound people oday, like sma phones, compu e s and pe sonal
assis an s.
I , on he one hand, access o in o ma ion abou people’s emo ional s a e is an impo an ool o
p edic ing and p e en ing diseases, on he o he hand i opens up a huge po en ial o ac ions ha a e
no as noble, such as a ge ed ma ke ing. The e o e, i is necessa y ha measu es a e aken o p e en
he collec ion o his in o ma ion in an i egula manne , as well as i s exploi a ion. Fo una ely, he e a e
se e al go e nmen ini ia i es on da a collec ion and use ha p o ide g ea e secu i y in his ega d.
As a u u e wo k, i is possible o poin ou some p omising di ec ions, namely he c ossing o in o ma-
ion ob ained abou emo ional s a es wi h labo a o y analyses, in o de o iden i y he impac s o he le els
o ho mones, i amins, e c. in people’s emo ional p o ile.
Ano he line o esea ch o be explo ed om his wo k is he p edic ion o human beha iou based on
people’s commen s, ne wo ks and in e ac ions. Thus, by knowing he emo ional and social aspec s ha
in luence people in hei decision-making, i may be possible o p edic wha beha iou s a popula ion can
ake.
134
Bibliog aphy
[1] Z. A. Aghba i. “A ay-index: a plug&sea ch K nea es neighbo s me hod o high-dimensional da a”.
In:
Da a & Knowledge Enginee ing
52.3 (2005), pp. 333–352. issn: 0169-023X. doi: h ps:
//doi.o g/10.1016/j.da ak.2004.06.015. u l: h ps://www.sciencedi ec .
com/science/a icle/pii/S0169023X04001260 (ci . on p. 24).
[2] E. Agi e and G. Rigau. “Wo d Sense Disambigua ion Using Concep ual Densi y”. In:
P oceedings
o he 16 h Con e ence on Compu a ional Linguis ics - Volume 1
. Copenhagen, Denma k: Asso-
cia ion o Compu a ional Linguis ics, 1996, pp. 16–22. doi: 10.3115/992628.992635. u l:
h ps://doi.o g/10.3115/992628.992635 (ci . on p. 43).
[3] E. Agi e and M. S e enson. “Knowledge Sou ces o WSD”. In:
Wo d Sense Disambigua ion: Al-
go i hms and Applica ions
. Ed. by E. Agi e and P. Edmonds. Do d ech : Sp inge Ne he lands,
2006, pp. 217–251. isbn: 978-1-4020-4809-8. doi: 10.1007/978- 1- 4020- 4809- 8_8
(ci . on p. 42).
[4] G. W. Allpo and H. S. Odbe . “T ai -names: A psycho-lexical s udy.” In:
Psychological mono-
g aphs
47.1 (1936), p. i (ci . on p. 16).
[5] M. J. V. Amo im and M. Be ch . “O uso da webcam na educação”. In:
RENOTE
7.3 (2009),
pp. 519–529 (ci . on p. 25).
[6] G. As on and L. Bu na d.
The BNC handbook: explo ing he B i ish Na ional Co pus wi h SARA
.
Caps one, 1998 (ci . on p. 16).
[7] J. A se ias e al. “Combining Mul iple Me hods o he Au oma ic Cons uc ion o Mul ilingual
Wo dNe s”. In:
CoRR
cmp-lg/9709003 (1997). u l: h p://a xi .o g/abs/cmp-lg/970
9003 (ci . on p. 43).
[8] J. R. A e ill.
A seman ic a las o emo ional concep s
. Ame ican Psycholog. Ass., Jou nal Suppl.
Abs ac Se ice, 1975 (ci . on p. 16).
135