-
Notifications
You must be signed in to change notification settings - Fork 2
/
m_get_nearest_neighbours.py
179 lines (144 loc) · 52.8 KB
/
m_get_nearest_neighbours.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
import numpy
import pandas as pd
import ast
from datetime import datetime
from collections import Counter
import torch
from transformers import AutoTokenizer, AutoModel, BertModel
from n_visualizing_terms import visualize_embs
#original finbert raw embeddings
# df = pd.read_csv(r'E:\Projects\Emotion_detection_gihan\finbert_experiments\data_processed\term_emb_label\all_emo.csv')
#new ones_collected by passing through the finbert
df = pd.read_csv(r'E:\Projects\Emotion_detection_gihan\finbert_experiments\data_processed\through_bert.csv')
df.columns = ['index','word','label','embedding']
# print(df.head())
# print(df.columns)
df = df.dropna()
# from scipy import spatial
#
# dataSetI = [1, 0, -1]
# dataSetII = [1,-1, 0]
# result = 1 - spatial.distance.cosine(dataSetI, dataSetII)
# print(result)
from sklearn.metrics.pairwise import cosine_similarity
# dis = cosine_similarity([[1, 0, -1]], [[1,-1, 0]])
#terms seperated from 0.05 and -0.05 threshold
filtered_words = ['objected', 'punishments', 'abnormalities', 'awful', 'frustrating', 'poisonous', 'irritating', 'scares', 'disturbed', 'hating', 'insulting', 'resented', 'furious', 'appalled', 'destroying', 'horrible', 'disrupt', 'annoying', 'sabotage', 'curses', 'oppression', 'sting', 'deprived', 'attackers', 'cursed', 'fraudulent', 'denounced', 'moaning', 'fucked', 'cancers', 'resentment', 'accusations', 'abandoning', 'cursing', 'weaken', 'brutality', 'wasted', 'prick', 'condemn', 'blame', 'stinging', 'betrayal', 'harmful', 'dreadful', 'disturbances', 'dictatorship', 'starvation', 'grotesque', 'humiliating', 'prisoner', 'hideous', 'invade', 'accuse', 'beheaded', 'insults', 'unlawful', 'furiously', 'hostile', 'collapses', 'threat', 'yanking', 'stung', 'instability', 'hysterical', 'insane', 'toxin', 'harshly', 'perpetrators', 'angry', 'annoyed', 'ripping', 'moans', 'invasions', 'frightening', 'inappropriate', 'attacks', 'horrific', 'disturbance', 'brutally', 'murderous', 'rampage', 'revoked', 'deteriorating', 'ravaged', 'absurd', 'scowled', 'alleging', 'criticizing', 'insanity', 'destructive', 'atrocities', 'ridiculous', 'assaulted', 'threaten', 'sucked', 'disgusted', 'outraged', 'strife', 'bastards', 'suck', 'criticisms', 'menacing', 'unpleasant', 'deprivation', 'tormented', 'malaria', 'shortages', 'forbade', 'writhing', 'prosecuted', 'parasitic', 'threatening', 'irrational', 'pained', 'screwing', 'deposed', 'poverty', 'hostility', 'protesting', 'attacking', 'idiots', 'devastation', 'abandoned', 'hates', 'assault', 'offended', 'yanked', 'hissing', 'coldly', 'tainted', 'deterioration', 'lesions', 'accused', 'victim', 'accusation', 'decreases', 'abandonment', 'dislike', 'smashed', 'stigma', 'attacked', 'ruthless', 'angrily', 'neglect', 'blaming', 'complained', 'stupid', 'threatens', 'rejecting', 'hostage', 'explode', 'disgusting', 'poisoned', 'dilapidated', 'condemning', 'terrible', 'wrenched', 'bitterness', 'threatened', 'shredded', 'vicious', 'asshole', 'complaints', 'enraged', 'provoked', 'menace', 'foolish', 'catastrophic', 'repression', 'ignores', 'irritation', 'unacceptable', 'malicious', 'conflicts', 'raiding', 'crazed', 'incarcerated', 'inequality', 'bitch', 'detrimental', 'horribly', 'rejection', 'threats', 'discarded', 'rodents', 'madman', 'unbearable', 'alcoholism', 'unreasonable', 'stabbed', 'prisoners', 'distrust', 'unhappy', 'punished', 'collapsing', 'despised', 'outlawed', 'crumbling', 'offenses', 'disastrous', 'terrifying', 'insulted', 'destroy', 'slapping', 'prohibits', 'distraught', 'clashes', 'brawl', 'anguish', 'blamed', 'erroneously', 'humiliated', 'undermine', 'damaging', 'murdering', 'grimaced', 'destroys', 'jerked', 'stupidity', 'tyrant', 'sucks', 'worsened', 'homeless', 'whimpered', 'angered', 'psychotic', 'shitty', 'banging', 'sobbed', 'diseases', 'explodes', 'prohibiting', 'illnesses', 'assaults', 'disliked', 'unsuitable', 'attack', 'wrecked', 'screwed', 'bothering', 'inmate', 'implicated', 'oppressive', 'growls', 'rebelled', 'poison', 'harmed', 'complain', 'ambushed', 'accusing', 'looting', 'flees', 'criticized', 'abusive', 'stabbing', 'detainees', 'outrageous', 'violently', 'whimper', 'powerless', 'messed', 'persecuted', 'lunatic', 'sucking', 'deportation', 'ruining', 'criticised', 'jerking', 'complaining', 'discrimination', 'pissed', 'ruined', 'slash', 'paranoid', 'disease', 'destroyed', 'feud', 'spite', 'rude', 'holocaust', 'bully', 'conflict', 'smash', 'hate', 'screaming', 'evil', 'scar', 'distress', 'mad', 'criminal', 'enemy', 'punishment', 'adverse', 'wrongly', 'crushing', 'curse', 'bomb', 'bad', 'crushed', 'insult', 'jerk', 'scream', 'violent', 'killing', 'beating', 'torture', 'bloody', 'steal', 'raging', 'misunderstanding', 'deny', 'abuse', 'frustration', 'invasion', 'damn', 'aggression', 'fraud', 'offense', 'madness', 'dispute', 'bitter', 'complaint', 'confront', 'stab', 'mortality', 'anger', 'deadly', 'brutal', 'disaster', 'fatal', 'suspicious', 'betray', 'violation', 'whip', 'tremor', 'offensive', 'unfair', 'worse', 'lying', 'prison', 'wreck', 'worst', 'shortage', 'intruder', 'upset', 'injustice', 'boiling', 'shit', 'stolen', 'witch', 'fight', 'selfish', 'nasty', 'skepticism', 'speculated', 'expect', 'upbeat', 'delightful', 'magical', 'attaining', 'championed', 'enjoyable', 'endeavor', 'celebrations', 'predicted', 'exciting', 'cadiz', 'invited', 'eager', 'gatherings', 'celebrate', 'acknowledges', 'intent', 'enthusiast', 'showcasing', 'illustrious', 'anticipated', 'mystical', 'undertake', 'celebrates', 'seek', 'northwards', 'ambition', 'mentoring', 'showcases', 'highlighting', 'eagerly', 'delighted', 'provocative', 'showcased', 'dazzling', 'willing', 'beautifully', 'amazement', 'endeavors', 'spearheaded', 'yearning', 'futuristic', 'utilize', 'expansive', 'invites', 'progressing', 'seductive', 'experimentation', 'arrays', 'initiating', 'daring', 'festivities', 'encouraging', 'artisans', 'ambitions', 'influencing', 'expectation', 'energetic', 'markedly', 'expecting', 'willingness', 'celebrating', 'asserting', 'confident', 'revered', 'inspire', 'ambitious', 'upgrading', 'innovative', 'emphasizing', 'pious', 'facilitating', 'thrilling', 'imaginative', 'predicting', 'commemorating', 'befriended', 'apprehension', 'stimulate', 'sited', 'memorable', 'assessing', 'stimulated', 'cheerful', 'expectations', 'encourages', 'hesitantly', 'hopefully', 'anxious', 'enthusiastically', 'insistent', 'accomplishment', 'profoundly', 'warmly', 'routinely', 'formulated', 'luxurious', 'reassured', 'marvelous', 'expects', 'admiration', 'explorers', 'facilitated', 'expected', 'picturesque', 'seeks', 'subtly', 'securely', 'adventurous', 'requesting', 'successes', 'achievements', 'optimistic', 'thrilled', 'astonishment', 'brilliance', 'inspiring', 'lauded', 'aspirations', 'hurrying', 'noteworthy', 'succeed', 'caressing', 'exemplary', 'anxiously', 'enthusiastic', 'intrigued', 'impatient', 'refurbished', 'splendid', 'contemplating', 'invite', 'recreated', 'integrating', 'accelerating', 'inviting', 'mischievous', 'facilitates', 'shimmering', 'remodeled', 'anticipating', 'desires', 'curving', 'prosperous', 'astonished', 'astonishing', 'journeys', 'glistening', 'theoretically', 'excited', 'pulsing', 'predict', 'lured', 'urging', 'invitation', 'functioned', 'excitedly', 'secluded', 'informally', 'reiterated', 'courageous', 'accomplishments', 'empowered', 'engages', 'spectacular', 'cautious', 'proposing', 'acknowledging', 'visionary', 'optimism', 'success', 'relocating', 'inspirational', 'philanthropic', 'utilizes', 'adorned', 'welcoming', 'confidently', 'amazingly', 'extravagant', 'refurbishment', 'excitement', 'celebration', 'await', 'intriguing', 'researches', 'evaluating', 'adventurer', 'modernized', 'alleviate', 'advising', 'hesitant', 'advocating', 'utilizing', 'peacefully', 'invitations', 'enthusiasm', 'envisioned', 'spacious', 'succeeds', 'hopeful', 'leisure', 'forming', 'planning', 'peaceful', 'bold', 'recreation', 'voyage', 'adventure', 'faith', 'youth', 'perfection', 'determined', 'forecast', 'experiment', 'inspiration', 'church', 'anticipation', 'successful', 'recreational', 'vision', 'inspired', 'reconstruction', 'expedition', 'entertainment', 'graduation', 'luck', 'entertaining', 'appeal', 'engaged', 'hope', 'perfect', 'blessing', 'vacation', 'magnificent', 'god', 'achievement', 'brave', 'glow', 'curiosity', 'alive', 'explore', 'healing', 'spirits', 'keen', 'celebrated', 'embrace', 'oppression', 'collapses', 'asshole', 'ill', 'crumbling', 'idiots', 'cursing', 'unsuitable', 'garbage', 'tyrant', 'cheating', 'destroys', 'moaning', 'catastrophe', 'insults', 'collapsing', 'perished', 'deterioration', 'humiliating', 'harmful', 'frightening', 'menacing', 'tricked', 'cheat', 'murderous', 'violently', 'deteriorated', 'despair', 'hissing', 'jerking', 'disturbances', 'ruining', 'pained', 'rotherham', 'crap', 'enraged', 'abnormalities', 'corpses', 'vomiting', 'persecuted', 'deteriorating', 'distraught', 'crazed', 'dreadful', 'defective', 'assaults', 'irrational', 'smeared', 'perpetrators', 'unbearable', 'unreasonable', 'moans', 'abuses', 'stigma', 'revoked', 'tormented', 'horrified', 'yanking', 'vomit', 'condemnation', 'disgusting', 'vulgar', 'detrimental', 'repression', 'denounced', 'shitty', 'carnage', 'harshly', 'crippled', 'insulting', 'annoying', 'brutally', 'shredded', 'horrors', 'outraged', 'catastrophic', 'dilapidated', 'obscene', 'bullshit', 'terrifying', 'illnesses', 'rejecting', 'sour', 'contaminated', 'irritating', 'humiliated', 'horribly', 'shit', 'growls', 'angered', 'disliked', 'hostility', 'greasy', 'stains', 'horrific', 'faulty', 'gall', 'grotesque', 'disgusted', 'ravaged', 'atrocities', 'resentment', 'insulted', 'condemning', 'muddy', 'poisonous', 'psychotic', 'raging', 'weaken', 'nasty', 'failures', 'vicious', 'brutality', 'trash', 'horrible', 'worsened', 'offenses', 'rodents', 'distorted', 'beheaded', 'stain', 'monstrous', 'ruthless', 'fearful', 'filthy', 'punishments', 'despised', 'tortured', 'appalled', 'hideous', 'coldly', 'stink', 'rubbish', 'abandoning', 'rejection', 'distrust', 'cheated', 'sediments', 'awful', 'stupidity', 'defeats', 'incarcerated', 'condemn', 'fatty', 'yellowish', 'whimper', 'hate', 'destructive', 'failure', 'poverty', 'toxic', 'lunatic', 'discrimination', 'poison', 'devil', 'lose', 'mad', 'idiot', 'messy', 'abuse', 'elimination', 'bloody', 'dispose', 'suffering', 'disaster', 'ugly', 'hostile', 'taboo', 'torture', 'holocaust', 'poisoning', 'lying', 'spider', 'bitterness', 'unpleasant', 'dirty', 'rash', 'threatening', 'insult', 'horror', 'devastating', 'miserable', 'evil', 'guilt', 'violent', 'dislike', 'dying', 'disease', 'criminal', 'smell', 'deprivation', 'betrayal', 'slug', 'wasted', 'mosquito', 'shame', 'deserted', 'stealing', 'nausea', 'distress', 'enemy', 'dirt', 'misery', 'homeless', 'oppression', 'deterioration', 'illnesses', 'freaked', 'hurting', 'annoyed', 'awful', 'attacker', 'catastrophe', 'hostile', 'damaging', 'screams', 'horrific', 'instability', 'prosecuted', 'invading', 'outraged', 'harshly', 'scary', 'moans', 'writhing', 'weaken', 'abandoned', 'destructive', 'murdering', 'stabbing', 'hysteria', 'ruining', 'anguish', 'insulting', 'slaughtered', 'hostility', 'deteriorating', 'injuring', 'terrified', 'enraged', 'villains', 'pained', 'disturbances', 'horrors', 'despised', 'scares', 'discarded', 'crumbling', 'afraid', 'denounced', 'crippled', 'angered', 'growls', 'disused', 'cursing', 'shocking', 'brutal', 'humiliating', 'failure', 'collapse', 'wounding', 'whimper', 'tremor', 'disturbance', 'fears', 'harmed', 'infection', 'devastating', 'destroying', 'sabotage', 'monstrous', 'illness', 'harmful', 'looted', 'shriek', 'resentment', 'injured', 'futile', 'hideous', 'condemning', 'tormented', 'murderous', 'abandonment', 'suicidal', 'irritating', 'distraught', 'insults', 'scared', 'invasions', 'fearing', 'shredded', 'beheaded', 'fled', 'detrimental', 'perpetrators', 'oppressive', 'undermine', 'collapses', 'frightening', 'attackers', 'hissing', 'fearful', 'fractures', 'appalled', 'inability', 'poisonous', 'frightened', 'unbearable', 'despair', 'ignores', 'terrorists', 'destroys', 'stabbed', 'explodes', 'assaulted', 'explode', 'abandoning', 'horrible', 'moaning', 'psychotic', 'defective', 'scare', 'uninhabited', 'seizures', 'unsafe', 'disgusted', 'ambushed', 'punishments', 'dreadful', 'catastrophic', 'failures', 'humiliated', 'terrifying', 'frustrating', 'crashes', 'flees', 'prevents', 'disastrous', 'attacking', 'evacuate', 'malicious', 'sobbed', 'criminals', 'incarcerated', 'demonic', 'brutally', 'trembled', 'insulted', 'powerless', 'irrational', 'bruised', 'grotesque', 'hysterical', 'menacing', 'rejecting', 'yanking', 'fleeing', 'outlawed', 'ruthless', 'ravaged', 'crazed', 'perished', 'horribly', 'fraudulent', 'worsened', 'assaults', 'sobbing', 'faulty', 'horrified', 'persecuted', 'screaming', 'scream', 'invaders', 'collapsing', 'abnormalities', 'fright', 'dilapidated', 'deserted', 'wrecked', 'villain', 'devastation', 'derelict', 'condemn', 'panicked', 'tragedy', 'ruin', 'ruined', 'monster', 'criminal', 'curse', 'violation', 'abuse', 'destroyed', 'injury', 'contaminated', 'suspect', 'failing', 'threatening', 'elimination', 'unstable', 'accident', 'raging', 'threaten', 'panic', 'deprivation', 'danger', 'discrimination', 'evil', 'punishment', 'crushing', 'bully', 'suicide', 'devil', 'deadly', 'disease', 'disaster', 'violently', 'avoiding', 'intruder', 'downfall', 'suffering', 'unnatural', 'attack', 'horror', 'traumatic', 'wreck', 'unrest', 'buried', 'fear', 'stab', 'dying', 'worst', 'suspicion', 'terrible', 'vulnerability', 'terror', 'worrying', 'nightmare', 'violent', 'avoid', 'ill', 'kill', 'conflict', 'hostage', 'die', 'killing', 'scar', 'stigma', 'threat', 'beating', 'broken', 'shaking', 'haunt', 'victim', 'insane', 'doomed', 'torture', 'poison', 'hurt', 'mortality', 'dangerous', 'fatal', 'assault', 'hiding', 'cursed', 'crushed', 'enemy', 'harm', 'securely', 'amazingly', 'refurbished', 'terrific', 'amazed', 'successes', 'gatherings', 'northwards', 'serene', 'adorned', 'bedfordshire', 'optimism', 'flawless', 'adored', 'accomplish', 'upbeat', 'picturesque', 'aachen', 'markedly', 'illustrious', 'astonishing', 'sublime', 'caressed', 'accolades', 'asserting', 'mastery', 'thanking', 'pulsing', 'enthusiastically', 'musically', 'heroic', 'encouraging', 'celebration', 'triumphant', 'recreated', 'solemnly', 'celebrating', 'befriended', 'energetic', 'accomplishments', 'intrigued', 'elegance', 'tenderly', 'delighted', 'dominating', 'exquisite', 'chuckle', 'thankful', 'rouen', 'textures', 'celebrations', 'inspirational', 'utilizing', 'courageous', 'calmed', 'cheerful', 'eager', 'gorgeous', 'spacious', 'mischievous', 'pisa', 'vigorous', 'exemplary', 'stimulate', 'triumph', 'satisfactory', 'prestige', 'gleam', 'yearning', 'incredible', 'commemoration', 'championed', 'desires', 'regaining', 'delicious', 'hopeful', 'wonderful', 'orchestral', 'shimmering', 'spirituality', 'fascinating', 'relaxed', 'sympathetic', 'blessings', 'pledge', 'facilitated', 'majestic', 'praising', 'apical', 'expansive', 'encircled', 'advocating', 'admiration', 'delicately', 'sparkled', 'forceful', 'amazement', 'confidently', 'beaming', 'reassured', 'gracefully', 'compassionate', 'seductive', 'attaining', 'victories', 'chuckles', 'complimented', 'stillness', 'upscale', 'philanthropic', 'lured', 'lullaby', 'delight', 'cadiz', 'cheerfully', 'treasures', 'mentoring', 'heavenly', 'fascinated', 'reassuring', 'tenderness', 'pious', 'magnificent', 'intimately', 'caress', 'commemorating', 'encourages', 'empowered', 'commemorate', 'inspire', 'strengthening', 'soothing', 'acknowledges', 'disclosed', 'confidence', 'marvelous', 'supportive', 'showcased', 'acknowledging', 'imaginative', 'sturdy', 'influencing', 'streamlined', 'majority', 'memorable', 'commemorative', 'friendships', 'overseen', 'decorate', 'relaxing', 'celebrate', 'intimacy', 'multitude', 'settles', 'grafton', 'entertainer', 'artisans', 'proficiency', 'facilitates', 'enthusiastic', 'inspiring', 'splendid', 'prowess', 'thrilled', 'humorous', 'harmonies', 'plurality', 'quieter', 'playful', 'philanthropy', 'intriguing', 'endeavors', 'honoring', 'optimistic', 'extravagant', 'educators', 'modernized', 'effortlessly', 'praises', 'luxurious', 'celebrates', 'remodeled', 'peacefully', 'glittering', 'lauded', 'festivities', 'comforting', 'pleased', 'encouraged', 'stimulated', 'graceful', 'astonishment', 'enthusiast', 'sparkle', 'beautifully', 'gottingen', 'facilitating', 'profoundly', 'stunning', 'creamy', 'palaces', 'peaceful', 'elegant', 'excitedly', 'adorable', 'evaluating', 'sizable', 'encourage', 'relaxation', 'aristocratic', 'glistening', 'playfully', 'delightful', 'embracing', 'subtly', 'passionate', 'calming', 'fabulous', 'lovely', 'ornate', 'hurrying', 'thrilling', 'accelerating', 'enjoyable', 'credible', 'pledged', 'eagerly', 'excelled', 'glorious', 'victorious', 'revered', 'celestial', 'improves', 'prosperous', 'astonished', 'giggling', 'warmly', 'visionary', 'accomplishment', 'glided', 'witty', 'jubilee', 'beam', 'excellent', 'strong', 'victor', 'marriage', 'medal', 'gift', 'kiss', 'inspired', 'refreshing', 'orchestra', 'sweetheart', 'graduation', 'masterpiece', 'warm', 'happy', 'youth', 'privileged', 'romance', 'comfortable', 'peace', 'clap', 'close', 'bouquet', 'sunshine', 'great', 'friendship', 'positively', 'champion', 'harmony', 'important', 'embrace', 'generosity', 'helpful', 'perfect', 'inspiration', 'devoted', 'prepared', 'calm', 'amazing', 'meditation', 'procession', 'fantastic', 'fun', 'generous', 'appreciation', 'fancy', 'shining', 'princely', 'fortune', 'evergreen', 'liking', 'thriving', 'gratitude', 'praise', 'comfort', 'awesome', 'excel', 'able', 'entertainment', 'musical', 'hymn', 'glory', 'achieve', 'touched', 'victory', 'authentic', 'satisfied', 'accompaniment', 'beauty', 'clear', 'entertaining', 'revival', 'expecting', 'cheer', 'ceremony', 'successful', 'success', 'bliss', 'determined', 'lucky', 'quiet', 'hug', 'angel', 'joy', 'liberty', 'sunny', 'entertained', 'sensual', 'impressed', 'salute', 'elevation', 'opera', 'succeed', 'cautious', 'enlightenment', 'freedom', 'love', 'excellence', 'achievement', 'therapeutic', 'enchanted', 'excited', 'willing', 'hero', 'reward', 'excitement', 'unification', 'dance', 'vacation', 'compliment', 'engaged', 'glad', 'sterling', 'nice', 'intimate', 'music', 'twinkle', 'affection', 'loved', 'venerable', 'immaculate', 'oasis', 'outstanding', 'scholarship', 'praised', 'applause', 'electric', 'grateful', 'loving', 'happiness', 'certain', 'flirt', 'lyrical', 'supported', 'leisure', 'curious', 'friendly', 'thrill', 'heroes', 'blessed', 'god', 'hoping', 'easy', 'reliable', 'winning', 'sing', 'aspiring', 'cool', 'glitter', 'illumination', 'volunteer', 'free', 'laughter', 'progression', 'enjoying', 'glow', 'relieved', 'symphony', 'winner', 'cheering', 'enjoy', 'miracle', 'celebrated', 'pleasant', 'esteem', 'festival', 'holiday', 'motivated', 'celebrity', 'treasure', 'powerful', 'familiar', 'kind', 'chant', 'magical', 'radiant', 'proud', 'smile', 'intuitive', 'lover', 'smiling', 'accepting', 'gem', 'wow', 'brilliant', 'accomplished', 'enthusiasm', 'freely', 'superstar', 'saint', 'intelligence', 'companion', 'emancipation', 'charity', 'spirits', 'young', 'interested', 'star', 'connected', 'understanding', 'buddy', 'glide', 'faith', 'engaging', 'pride', 'fulfillment', 'clever', 'sweet', 'providing', 'inauguration', 'cooperative', 'merry', 'worship', 'succeeding', 'beautiful', 'attracted', 'fortunate', 'blessing', 'coronation', 'entertain', 'happily', 'bless', 'choral', 'holiness', 'blossom', 'passion', 'keen', 'tender', 'bright', 'informed', 'relax', 'perfection', 'positive', 'freeing', 'luxury', 'darling', 'ambition', 'healing', 'complement', 'award', 'exciting', 'confident', 'bloom', 'romantic', 'elite', 'inability', 'regretted', 'enraged', 'slapping', 'throbbed', 'died', 'horribly', 'collapses', 'hurts', 'harmful', 'suicidal', 'eliminating', 'terrifying', 'terrified', 'attacking', 'problematic', 'terrible', 'denounced', 'moans', 'mistakenly', 'persecuted', 'shitty', 'fatally', 'meaningless', 'dying', 'injuring', 'miserable', 'sickness', 'devastation', 'betray', 'catastrophe', 'horrible', 'insulted', 'hurting', 'pained', 'collapsing', 'fails', 'disgusting', 'dreadful', 'sobbing', 'assaults', 'frowning', 'despair', 'distraught', 'fatalities', 'despised', 'stabbing', 'rejects', 'frightened', 'deteriorated', 'blindly', 'whimper', 'slaughtered', 'frightening', 'opposes', 'resentment', 'sobbed', 'flees', 'deaths', 'illnesses', 'moaning', 'unsuitable', 'decreases', 'confusing', 'defective', 'hostility', 'whimpered', 'contradictory', 'appalled', 'death', 'undermine', 'murderers', 'ruining', 'unsuccessful', 'disliked', 'ached', 'breakup', 'refuses', 'poisonous', 'detainees', 'refusing', 'oppressive', 'misunderstanding', 'destroying', 'collapse', 'denies', 'crumpled', 'writhing', 'unacceptable', 'unbearable', 'horrific', 'disturbances', 'disgusted', 'incorrectly', 'awful', 'deterioration', 'punishments', 'insults', 'disused', 'crazed', 'condemn', 'perpetrators', 'violently', 'rebelled', 'removes', 'stupidity', 'criticisms', 'unhappy', 'powerless', 'demise', 'slain', 'lifeless', 'irritating', 'incompatible', 'resented', 'outraged', 'fearful', 'failures', 'worthless', 'mortality', 'bruised', 'abandoning', 'murdering', 'weaken', 'unfit', 'pointless', 'loses', 'bitterness', 'unpleasant', 'embarrassing', 'crashes', 'faulty', 'deposed', 'anguish', 'annoyed', 'fractured', 'burials', 'looting', 'toppled', 'hideous', 'detrimental', 'wrongly', 'dies', 'dilapidated', 'oppression', 'ravaged', 'abandonment', 'misleading', 'shredded', 'forbade', 'crumbling', 'worrying', 'sadly', 'destroy', 'condemning', 'beheaded', 'falling', 'incarcerated', 'growls', 'abnormalities', 'rejected', 'deteriorating', 'prohibiting', 'panicked', 'crippled', 'frustrating', 'painfully', 'destroys', 'yanking', 'murderous', 'coldly', 'menacing', 'instability', 'bothering', 'criticizing', 'wrenched', 'betrayal', 'insulting', 'damaging', 'unfortunate', 'misunderstood', 'inaccurate', 'worsened', 'devastating', 'erroneously', 'futile', 'distorted', 'humiliated', 'catastrophic', 'ineffective', 'deceased', 'refusal', 'tormented', 'rejecting', 'painful', 'confuse', 'disastrous', 'outlawed', 'illness', 'perished', 'hospitalized', 'harshly', 'harmed', 'ignores', 'terribly', 'humiliating', 'injured', 'doomed', 'shortage', 'nasty', 'apologize', 'terminate', 'scar', 'disabled', 'abuse', 'bleeding', 'deprivation', 'desperate', 'disturbed', 'invalid', 'die', 'worse', 'failed', 'negative', 'beating', 'conflict', 'fault', 'suffering', 'mistake', 'denied', 'losing', 'criticism', 'ruined', 'disease', 'deadly', 'discrimination', 'unfortunately', 'torture', 'lose', 'curse', 'stab', 'badly', 'violation', 'forbid', 'wasting', 'prisoner', 'guilt', 'unfair', 'crash', 'runaway', 'poison', 'vulnerability', 'trash', 'elimination', 'broken', 'ashamed', 'unrest', 'stigma', 'damages', 'flaw', 'failing', 'cursed', 'crushed', 'destroyed', 'misery', 'sick', 'homeless', 'steal', 'disaster', 'upset', 'loss', 'suicide', 'dead', 'unable', 'embarrassed', 'grave', 'poverty', 'damage', 'regret', 'downfall', 'tragedy', 'complain', 'buried', 'abandoned', 'insult', 'adverse', 'debt', 'suppress', 'rejection', 'shattered', 'refused', 'mad', 'handicap', 'prison', 'pity', 'evil', 'contaminated', 'ill', 'traumatic', 'ruin', 'shame', 'hurt', 'holocaust', 'crying', 'disability', 'sabotage', 'injury', 'wreck', 'weeping', 'cemetery', 'deserted', 'distress', 'victim', 'vulnerable', 'obituary', 'bad', 'failure', 'guilty', 'accident', 'shrink', 'inadequate', 'fatal', 'tremor', 'disturbance', 'compliment', 'astonished', 'seductive', 'terrific', 'marvelous', 'generosity', 'exciting', 'unusually', 'remarkable', 'delighted', 'delicately', 'giggling', 'enthusiasm', 'glided', 'humorous', 'refurbished', 'accolades', 'noticeably', 'kindness', 'enthusiastic', 'coincidence', 'astonishing', 'excitedly', 'complimented', 'overwhelmingly', 'revered', 'stimulated', 'chuckle', 'showcases', 'noteworthy', 'warmly', 'hesitantly', 'gracefully', 'surprised', 'picturesque', 'chuckles', 'applause', 'beautifully', 'endeavors', 'surprising', 'magnificent', 'decorate', 'fabulous', 'thrilling', 'enthusiastically', 'dazzling', 'unprecedented', 'celebrates', 'amazingly', 'amazed', 'glistening', 'exceptionally', 'lovely', 'sparkled', 'accomplishments', 'festivities', 'unexpected', 'exemplary', 'thrilled', 'philanthropic', 'unexpectedly', 'luminous', 'philanthropist', 'elusive', 'excited', 'subtly', 'provocative', 'intrigued', 'spectacular', 'stimulate', 'effortlessly', 'remarkably', 'honoring', 'brilliance', 'extravagant', 'excitement', 'amazement', 'praises', 'adorned', 'sincerity', 'ornate', 'refurbishment', 'showcased', 'splendid', 'admiration', 'surprisingly', 'markedly', 'cheerfully', 'caressed', 'sensual', 'creamy', 'elegance', 'glittering', 'sweetness', 'impatience', 'intriguing', 'mischievous', 'surprises', 'pious', 'exhibiting', 'curving', 'magical', 'curiosity', 'embrace', 'reward', 'celebration', 'splash', 'ceremony', 'award', 'tenderly', 'cooperation', 'solidarity', 'securely', 'endeavors', 'trusting', 'straightforward', 'proponents', 'reassuring', 'delicately', 'proposing', 'verify', 'friendships', 'educators', 'authenticity', 'cooperative', 'facilitated', 'encouraging', 'courageous', 'alliances', 'secluded', 'bedfordshire', 'succeeds', 'confident', 'orthodoxy', 'agree', 'noteworthy', 'refurbishment', 'acknowledging', 'prosperous', 'shimmering', 'refurbished', 'persuade', 'verified', 'devout', 'overseen', 'ensured', 'encourages', 'optimistic', 'authentic', 'believer', 'improves', 'warmly', 'assure', 'advisers', 'picturesque', 'mentoring', 'credibility', 'ensures', 'declares', 'skepticism', 'predicting', 'sincerity', 'attaining', 'convinces', 'stimulated', 'persuaded', 'markedly', 'advised', 'assured', 'facilitating', 'illustrious', 'forceful', 'strengthening', 'acknowledges', 'northwards', 'compassionate', 'complied', 'recreated', 'durable', 'empowered', 'lauded', 'encourage', 'reliable', 'showcasing', 'feasible', 'agrees', 'advise', 'preserving', 'advises', 'yearning', 'amazingly', 'reliability', 'privileged', 'recommends', 'asserting', 'subtly', 'soothing', 'proponent', 'credible', 'thoughtful', 'calming', 'initiating', 'strengthen', 'satisfactory', 'hopeful', 'revered', 'friendship', 'evaluating', 'inspirational', 'philanthropic', 'advocacy', 'guarantees', 'hero', 'spearheaded', 'facilitates', 'alleviate', 'generosity', 'profoundly', 'reiterated', 'helpful', 'advising', 'convinced', 'comforting', 'consistency', 'confirming', 'caressing', 'safeguard', 'authoritative', 'acquaintances', 'exemplary', 'reconciled', 'sizable', 'cooperate', 'showcased', 'gratitude', 'artisans', 'confidently', 'ambition', 'believers', 'reassure', 'befriended', 'successes', 'sturdy', 'protector', 'aiding', 'caress', 'respectful', 'coordinating', 'praises', 'delightful', 'confirms', 'optimism', 'curate', 'reinforcement', 'collaborate', 'effortlessly', 'approve', 'visionary', 'ensuring', 'closeness', 'advocating', 'promises', 'imaginative', 'urging', 'recapture', 'ornate', 'efficacy', 'assertion', 'rescuing', 'validation', 'assurance', 'formulated', 'agreeing', 'escorting', 'soothe', 'heroes', 'memorable', 'caressed', 'heroic', 'brilliance', 'shielded', 'understands', 'reassured', 'congregations', 'confidence', 'coach', 'guidance', 'intimate', 'freely', 'expert', 'strength', 'affection', 'efficient', 'evident', 'comfortable', 'cathedral', 'sympathetic', 'succeed', 'esteem', 'respects', 'modest', 'convincing', 'positive', 'agreed', 'promise', 'hope', 'church', 'appreciation', 'friendly', 'definitive', 'healing', 'comfort', 'wisdom', 'successful', 'respect', 'companion', 'united', 'advocate', 'god', 'understanding', 'believed', 'veteran', 'hymn', 'faith', 'agreement', 'inspire', 'effective', 'trust', 'dignity', 'independence', 'blessing', 'sage', 'inspired']
filtered_labels = ['anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anger', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'anticipation', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'disgust', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'fear', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'joy', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'sad', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'surprise', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust', 'trust']
def get_nearest_neighbours(embeding):
t1 = datetime.now()
tuples = []
for i,row_e in df.iterrows():
if(row_e['word'] in filtered_words):
dis = cosine_similarity([ast.literal_eval(row_e['embedding'])], embeding)
# print([row_e['tokens'],row_d['tokens'],dis])
tuples.append([row_e['word'],row_e['label'],dis,row_e['embedding']])
print('ok')
s_tup = sorted(tuples, key=lambda x: x[2])#sort tuples based on the cosine distance
neaarest_neighbs_words = []
neaarest_neighbs_embs = []
neaarest_neighbs_labels = []
for i,m in enumerate(s_tup[::-1]):
# print(m)
if(i<10):#getting the nearest 100 neighbours
neaarest_neighbs_words.append(m[0])
neaarest_neighbs_embs.append(ast.literal_eval(m[3]))
neaarest_neighbs_labels.append(m[1])
# print(numpy.shape(numpy.array(embeding[0])))
# print(numpy.shape(neaarest_neighbs_embs[0]))
neaarest_neighbs_words.append('sentence')
neaarest_neighbs_embs.append(numpy.array(embeding[0]))
neaarest_neighbs_labels.append('input')
t2 = datetime.now()
diff = t2-t1
print('time',diff)
print(Counter(neaarest_neighbs_labels))
print(neaarest_neighbs_words)
print(neaarest_neighbs_labels)
# print(neaarest_neighbs_embs)
#visualize the neighbours in 2d space
visualize_embs(neaarest_neighbs_labels,neaarest_neighbs_embs,neaarest_neighbs_words)
#Mean Pooling - Take attention mask into account for correct averaging
def mean_pooling(model_output, attention_mask):
token_embeddings = model_output[0] #First element of model_output contains all token embeddings
input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
sum_embeddings = torch.sum(token_embeddings * input_mask_expanded, 1)
sum_mask = torch.clamp(input_mask_expanded.sum(1), min=1e-9)
return sum_embeddings / sum_mask
model_name = "ProsusAI/finbert"
# model_name = "nateraw/bert-base-uncased-emotion"
# model_name = "bert-base-uncased"
#Load AutoModel from huggingface model repository
# from transformers import AutoTokenizer, AutoModelForSequenceClassification
# tokenizer = AutoTokenizer.from_pretrained("bhadresh-savani/distilbert-base-uncased-emotion")
#
# model = AutoModelForSequenceClassification.from_pretrained("bhadresh-savani/distilbert-base-uncased-emotion")
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModel.from_pretrained(model_name)
#get mean pooling for sentence embedding
# sentences = ['The world is experiencing unprecedenting challenges in economy from COVID-19.']
sentences = ['mahinda lost the battle and cried']
# sentences = ['frustrating', 'sad','whining','pleasure','fun','cry','love']
# sentence_labels = ['sad','sad','sad','joy','joy','sad','joy']
sentences = filtered_words
sentence_labels = filtered_labels
encoded_input = tokenizer(sentences, padding=True, truncation=True, max_length=128, return_tensors='pt')
# print(encoded_input)#max length 128 previousely
#Compute token embeddings
with torch.no_grad():
model_output = model(**encoded_input)
# print(model_output)
#Perform pooling. In this case, mean pooling
sentence_embeddings_raw = mean_pooling(model_output, encoded_input['attention_mask'])
sentence_embeddings = sentence_embeddings_raw.tolist()
print(numpy.shape(sentence_embeddings))
visualize_embs(sentence_labels,sentence_embeddings,sentences)
# print(sentence_embeddings,sentence_embeddings_raw)
print(numpy.shape(sentence_embeddings))
# get_nearest_neighbours(sentence_embeddings)
# # get embeddnings through finbert and final pooling layer
# model = BertModel.from_pretrained("ProsusAI/finbert",output_hidden_states=True)
# w_list = ['he is crying because he is sad']#sentences
# # w_list = ['comfort']
# # w_list = ['awful']
# embedding_out_list = []
# for w in w_list:
# sentence = w
# tokens = tokenizer.tokenize(sentence)
# print('shape after tokenize',numpy.shape(tokens))
# print(tokens)
#
# input_ids = torch.tensor(tokenizer.encode(sentence))[None, :] # Batch size 1
#
# outputs = model(input_ids)
# last_hidden_states = outputs # The last hidden-state is the first element of the output tuple
# # print(last_hidden_states)
#
# # #concatenating last four hidden layers
# hidden_states = outputs['hidden_states']
# # pooled_output = tf.keras.layers.concatenate(tuple([hidden_states[i] for i in [-4, -3, -2, -1]]))
# # pooled_output = torch.cat(tuple([hidden_states[i] for i in [-4, -3, -2, -1]]), dim=-1)
# pooled_output = list(hidden_states[-1][0])#picking the final pooling layer
#
# for i,token_emb in enumerate(pooled_output):#iterate through the word by word
# print(token_emb.tolist())
# print(numpy.shape(token_emb.tolist()))
# if(i!=1):continue
# sentence_embeddings = token_emb.tolist()
# break
#
#
# sentence_embeddings = [s for s in sentence_embeddings]
# print(w)
# print(sentence_embeddings)
# embedding_out_list.append(sentence_embeddings)
# # # print(sentence_embeddings,sentence_embeddings_raw)
# # # print(numpy.shape(sentence_embeddings))
# get_nearest_neighbours([sentence_embeddings])
#
# df = pd.DataFrame()
# df['words']=w_list
# df['labels'] = filtered_labels
# df['embeddinds']= embedding_out_list
#
# df.to_csv(r"E:\Projects\Emotion_detection_gihan\finbert_experiments\data_processed\through_bert.csv")