-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathNLP II - Sentiment Score.py
587 lines (557 loc) · 53.4 KB
/
NLP II - Sentiment Score.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
import pandas as pd
import re, codecs
def write_to_file(file_name, data):
with codecs.open("./" + file_name, "a", "utf-8") as f:
f.write(data)
def read_file(file_name):
data = list()
line_count = 0
ticker = ''
with codecs.open(file_name, encoding='utf-8') as f:
for line in f:
line_count += 1
if ticker == '':
ticker_from_text = line.rstrip('\r').rstrip('\n')
if not 'start' in ticker_from_text.lower():
ticker = ticker_from_text[ticker_from_text.find("(")+1:ticker_from_text.find(")")]
if ':' in ticker:
ticker = ticker.split(':')[-1]
result = line.rstrip('\r').rstrip('\n').lower().split('.')
data.append(result)
return data, ticker
# Loughran and McDonald Sentiment Word Lists (https://sraf.nd.edu/textual-analysis/resources/)
lmdict = {'Negative': ['abandon', 'abandoned', 'abandoning', 'abandonment', 'abandonments', 'abandons', 'abdicated',
'abdicates', 'abdicating', 'abdication', 'abdications', 'aberrant', 'aberration', 'aberrational',
'aberrations', 'abetting', 'abnormal', 'abnormalities', 'abnormality', 'abnormally', 'abolish',
'abolished', 'abolishes', 'abolishing', 'abrogate', 'abrogated', 'abrogates', 'abrogating',
'abrogation', 'abrogations', 'abrupt', 'abruptly', 'abruptness', 'absence', 'absences',
'absenteeism', 'abuse', 'abused', 'abuses', 'abusing', 'abusive', 'abusively', 'abusiveness',
'accident', 'accidental', 'accidentally', 'accidents', 'accusation', 'accusations', 'accuse',
'accused', 'accuses', 'accusing', 'acquiesce', 'acquiesced', 'acquiesces', 'acquiescing',
'acquit', 'acquits', 'acquittal', 'acquittals', 'acquitted', 'acquitting', 'adulterate',
'adulterated', 'adulterating', 'adulteration', 'adulterations', 'adversarial', 'adversaries',
'adversary', 'adverse', 'adversely', 'adversities', 'adversity', 'aftermath', 'aftermaths',
'against', 'aggravate', 'aggravated', 'aggravates', 'aggravating', 'aggravation', 'aggravations',
'alerted', 'alerting', 'alienate', 'alienated', 'alienates', 'alienating', 'alienation',
'alienations', 'allegation', 'allegations', 'allege', 'alleged', 'allegedly', 'alleges',
'alleging', 'annoy', 'annoyance', 'annoyances', 'annoyed', 'annoying', 'annoys', 'annul',
'annulled', 'annulling', 'annulment', 'annulments', 'annuls', 'anomalies', 'anomalous',
'anomalously', 'anomaly', 'anticompetitive', 'antitrust', 'argue', 'argued', 'arguing',
'argument', 'argumentative', 'arguments', 'arrearage', 'arrearages', 'arrears', 'arrest',
'arrested', 'arrests', 'artificially', 'assault', 'assaulted', 'assaulting', 'assaults',
'assertions', 'attrition', 'aversely', 'backdating', 'bad', 'bail', 'bailout', 'balk', 'balked',
'bankrupt', 'bankruptcies', 'bankruptcy', 'bankrupted', 'bankrupting', 'bankrupts', 'bans',
'barred', 'barrier', 'barriers', 'bottleneck', 'bottlenecks', 'boycott', 'boycotted',
'boycotting', 'boycotts', 'breach', 'breached', 'breaches', 'breaching', 'break', 'breakage',
'breakages', 'breakdown', 'breakdowns', 'breaking', 'breaks', 'bribe', 'bribed', 'briberies',
'bribery', 'bribes', 'bribing', 'bridge', 'broken', 'burden', 'burdened', 'burdening', 'burdens',
'burdensome', 'burned', 'calamities', 'calamitous', 'calamity', 'cancel', 'canceled',
'canceling', 'cancellation', 'cancellations', 'cancelled', 'cancelling', 'cancels', 'careless',
'carelessly', 'carelessness', 'catastrophe', 'catastrophes', 'catastrophic', 'catastrophically',
'caution', 'cautionary', 'cautioned', 'cautioning', 'cautions', 'cease', 'ceased', 'ceases',
'ceasing', 'censure', 'censured', 'censures', 'censuring', 'challenge', 'challenged',
'challenges', 'challenging', 'chargeoffs', 'circumvent', 'circumvented', 'circumventing',
'circumvention', 'circumventions', 'circumvents', 'claiming', 'claims', 'clawback', 'closed',
'closeout', 'closeouts', 'closing', 'closings', 'closure', 'closures', 'coerce', 'coerced',
'coerces', 'coercing', 'coercion', 'coercive', 'collapse', 'collapsed', 'collapses',
'collapsing', 'collision', 'collisions', 'collude', 'colluded', 'colludes', 'colluding',
'collusion', 'collusions', 'collusive', 'complain', 'complained', 'complaining', 'complains',
'complaint', 'complaints', 'complicate', 'complicated', 'complicates', 'complicating',
'complication', 'complications', 'compulsion', 'concealed', 'concealing', 'concede', 'conceded',
'concedes', 'conceding', 'concern', 'concerned', 'concerns', 'conciliating', 'conciliation',
'conciliations', 'condemn', 'condemnation', 'condemnations', 'condemned', 'condemning',
'condemns', 'condone', 'condoned', 'confess', 'confessed', 'confesses', 'confessing',
'confession', 'confine', 'confined', 'confinement', 'confinements', 'confines', 'confining',
'confiscate', 'confiscated', 'confiscates', 'confiscating', 'confiscation', 'confiscations',
'conflict', 'conflicted', 'conflicting', 'conflicts', 'confront', 'confrontation',
'confrontational', 'confrontations', 'confronted', 'confronting', 'confronts', 'confuse',
'confused', 'confuses', 'confusing', 'confusingly', 'confusion', 'conspiracies', 'conspiracy',
'conspirator', 'conspiratorial', 'conspirators', 'conspire', 'conspired', 'conspires',
'conspiring', 'contempt', 'contend', 'contended', 'contending', 'contends', 'contention',
'contentions', 'contentious', 'contentiously', 'contested', 'contesting', 'contraction',
'contractions', 'contradict', 'contradicted', 'contradicting', 'contradiction', 'contradictions',
'contradictory', 'contradicts', 'contrary', 'controversial', 'controversies', 'controversy',
'convict', 'convicted', 'convicting', 'conviction', 'convictions', 'corrected', 'correcting',
'correction', 'corrections', 'corrects', 'corrupt', 'corrupted', 'corrupting', 'corruption',
'corruptions', 'corruptly', 'corruptness', 'costly', 'counterclaim', 'counterclaimed',
'counterclaiming', 'counterclaims', 'counterfeit', 'counterfeited', 'counterfeiter',
'counterfeiters', 'counterfeiting', 'counterfeits', 'countermeasure', 'countermeasures', 'crime',
'crimes', 'criminal', 'criminally', 'criminals', 'crises', 'crisis', 'critical', 'critically',
'criticism', 'criticisms', 'criticize', 'criticized', 'criticizes', 'criticizing', 'crucial',
'crucially', 'culpability', 'culpable', 'culpably', 'cumbersome', 'curtail', 'curtailed',
'curtailing', 'curtailment', 'curtailments', 'curtails', 'cut', 'cutback', 'cutbacks',
'cyberattack', 'cyberattacks', 'cyberbullying', 'cybercrime', 'cybercrimes', 'cybercriminal',
'cybercriminals', 'damage', 'damaged', 'damages', 'damaging', 'dampen', 'dampened', 'danger',
'dangerous', 'dangerously', 'dangers', 'deadlock', 'deadlocked', 'deadlocking', 'deadlocks',
'deadweight', 'deadweights', 'debarment', 'debarments', 'debarred', 'deceased', 'deceit',
'deceitful', 'deceitfulness', 'deceive', 'deceived', 'deceives', 'deceiving', 'deception',
'deceptions', 'deceptive', 'deceptively', 'decline', 'declined', 'declines', 'declining',
'deface', 'defaced', 'defacement', 'defamation', 'defamations', 'defamatory', 'defame',
'defamed', 'defames', 'defaming', 'default', 'defaulted', 'defaulting', 'defaults', 'defeat',
'defeated', 'defeating', 'defeats', 'defect', 'defective', 'defects', 'defend', 'defendant',
'defendants', 'defended', 'defending', 'defends', 'defensive', 'defer', 'deficiencies',
'deficiency', 'deficient', 'deficit', 'deficits', 'defraud', 'defrauded', 'defrauding',
'defrauds', 'defunct', 'degradation', 'degradations', 'degrade', 'degraded', 'degrades',
'degrading', 'delay', 'delayed', 'delaying', 'delays', 'deleterious', 'deliberate',
'deliberated', 'deliberately', 'delinquencies', 'delinquency', 'delinquent', 'delinquently',
'delinquents', 'delist', 'delisted', 'delisting', 'delists', 'demise', 'demised', 'demises',
'demising', 'demolish', 'demolished', 'demolishes', 'demolishing', 'demolition', 'demolitions',
'demote', 'demoted', 'demotes', 'demoting', 'demotion', 'demotions', 'denial', 'denials',
'denied', 'denies', 'denigrate', 'denigrated', 'denigrates', 'denigrating', 'denigration',
'deny', 'denying', 'deplete', 'depleted', 'depletes', 'depleting', 'depletion', 'depletions',
'deprecation', 'depress', 'depressed', 'depresses', 'depressing', 'deprivation', 'deprive',
'deprived', 'deprives', 'depriving', 'derelict', 'dereliction', 'derogatory', 'destabilization',
'destabilize', 'destabilized', 'destabilizing', 'destroy', 'destroyed', 'destroying', 'destroys',
'destruction', 'destructive', 'detain', 'detained', 'detention', 'detentions', 'deter',
'deteriorate', 'deteriorated', 'deteriorates', 'deteriorating', 'deterioration',
'deteriorations', 'deterred', 'deterrence', 'deterrences', 'deterrent', 'deterrents',
'deterring', 'deters', 'detract', 'detracted', 'detracting', 'detriment', 'detrimental',
'detrimentally', 'detriments', 'devalue', 'devalued', 'devalues', 'devaluing', 'devastate',
'devastated', 'devastating', 'devastation', 'deviate', 'deviated', 'deviates', 'deviating',
'deviation', 'deviations', 'devolve', 'devolved', 'devolves', 'devolving', 'difficult',
'difficulties', 'difficultly', 'difficulty', 'diminish', 'diminished', 'diminishes',
'diminishing', 'diminution', 'disadvantage', 'disadvantaged', 'disadvantageous', 'disadvantages',
'disaffiliation', 'disagree', 'disagreeable', 'disagreed', 'disagreeing', 'disagreement',
'disagreements', 'disagrees', 'disallow', 'disallowance', 'disallowances', 'disallowed',
'disallowing', 'disallows', 'disappear', 'disappearance', 'disappearances', 'disappeared',
'disappearing', 'disappears', 'disappoint', 'disappointed', 'disappointing', 'disappointingly',
'disappointment', 'disappointments', 'disappoints', 'disapproval', 'disapprovals', 'disapprove',
'disapproved', 'disapproves', 'disapproving', 'disassociates', 'disassociating',
'disassociation', 'disassociations', 'disaster', 'disasters', 'disastrous', 'disastrously',
'disavow', 'disavowal', 'disavowed', 'disavowing', 'disavows', 'disciplinary', 'disclaim',
'disclaimed', 'disclaimer', 'disclaimers', 'disclaiming', 'disclaims', 'disclose', 'disclosed',
'discloses', 'disclosing', 'discontinuance', 'discontinuances', 'discontinuation',
'discontinuations', 'discontinue', 'discontinued', 'discontinues', 'discontinuing', 'discourage',
'discouraged', 'discourages', 'discouraging', 'discredit', 'discredited', 'discrediting',
'discredits', 'discrepancies', 'discrepancy', 'disfavor', 'disfavored', 'disfavoring',
'disfavors', 'disgorge', 'disgorged', 'disgorgement', 'disgorgements', 'disgorges', 'disgorging',
'disgrace', 'disgraceful', 'disgracefully', 'dishonest', 'dishonestly', 'dishonesty', 'dishonor',
'dishonorable', 'dishonorably', 'dishonored', 'dishonoring', 'dishonors', 'disincentives',
'disinterested', 'disinterestedly', 'disinterestedness', 'disloyal', 'disloyally', 'disloyalty',
'dismal', 'dismally', 'dismiss', 'dismissal', 'dismissals', 'dismissed', 'dismisses',
'dismissing', 'disorderly', 'disparage', 'disparaged', 'disparagement', 'disparagements',
'disparages', 'disparaging', 'disparagingly', 'disparities', 'disparity', 'displace',
'displaced', 'displacement', 'displacements', 'displaces', 'displacing', 'dispose', 'dispossess',
'dispossessed', 'dispossesses', 'dispossessing', 'disproportion', 'disproportional',
'disproportionate', 'disproportionately', 'dispute', 'disputed', 'disputes', 'disputing',
'disqualification', 'disqualifications', 'disqualified', 'disqualifies', 'disqualify',
'disqualifying', 'disregard', 'disregarded', 'disregarding', 'disregards', 'disreputable',
'disrepute', 'disrupt', 'disrupted', 'disrupting', 'disruption', 'disruptions', 'disruptive',
'disrupts', 'dissatisfaction', 'dissatisfied', 'dissent', 'dissented', 'dissenter', 'dissenters',
'dissenting', 'dissents', 'dissident', 'dissidents', 'dissolution', 'dissolutions', 'distort',
'distorted', 'distorting', 'distortion', 'distortions', 'distorts', 'distract', 'distracted',
'distracting', 'distraction', 'distractions', 'distracts', 'distress', 'distressed', 'disturb',
'disturbance', 'disturbances', 'disturbed', 'disturbing', 'disturbs', 'diversion', 'divert',
'diverted', 'diverting', 'diverts', 'divest', 'divested', 'divesting', 'divestiture',
'divestitures', 'divestment', 'divestments', 'divests', 'divorce', 'divorced', 'divulge',
'divulged', 'divulges', 'divulging', 'doubt', 'doubted', 'doubtful', 'doubts', 'downgrade',
'downgraded', 'downgrades', 'downgrading', 'downsize', 'downsized', 'downsizes', 'downsizing',
'downsizings', 'downtime', 'downtimes', 'downturn', 'downturns', 'downward', 'downwards', 'drag',
'drastic', 'drastically', 'drawback', 'drawbacks', 'dropped', 'drought', 'droughts', 'duress',
'dysfunction', 'dysfunctional', 'dysfunctions', 'easing', 'egregious', 'egregiously', 'embargo',
'embargoed', 'embargoes', 'embargoing', 'embarrass', 'embarrassed', 'embarrasses',
'embarrassing', 'embarrassment', 'embarrassments', 'embezzle', 'embezzled', 'embezzlement',
'embezzlements', 'embezzler', 'embezzles', 'embezzling', 'encroach', 'encroached', 'encroaches',
'encroaching', 'encroachment', 'encroachments', 'encumber', 'encumbered', 'encumbering',
'encumbers', 'encumbrance', 'encumbrances', 'endanger', 'endangered', 'endangering',
'endangerment', 'endangers', 'enjoin', 'enjoined', 'enjoining', 'enjoins', 'erode', 'eroded',
'erodes', 'eroding', 'erosion', 'erratic', 'erratically', 'erred', 'erring', 'erroneous',
'erroneously', 'error', 'errors', 'errs', 'escalate', 'escalated', 'escalates', 'escalating',
'evade', 'evaded', 'evades', 'evading', 'evasion', 'evasions', 'evasive', 'evict', 'evicted',
'evicting', 'eviction', 'evictions', 'evicts', 'exacerbate', 'exacerbated', 'exacerbates',
'exacerbating', 'exacerbation', 'exacerbations', 'exaggerate', 'exaggerated', 'exaggerates',
'exaggerating', 'exaggeration', 'excessive', 'excessively', 'exculpate', 'exculpated',
'exculpates', 'exculpating', 'exculpation', 'exculpations', 'exculpatory', 'exonerate',
'exonerated', 'exonerates', 'exonerating', 'exoneration', 'exonerations', 'exploit',
'exploitation', 'exploitations', 'exploitative', 'exploited', 'exploiting', 'exploits', 'expose',
'exposed', 'exposes', 'exposing', 'expropriate', 'expropriated', 'expropriates', 'expropriating',
'expropriation', 'expropriations', 'expulsion', 'expulsions', 'extenuating', 'fail', 'failed',
'failing', 'failings', 'fails', 'failure', 'failures', 'fallout', 'false', 'falsely',
'falsification', 'falsifications', 'falsified', 'falsifies', 'falsify', 'falsifying', 'falsity',
'fatalities', 'fatality', 'fatally', 'fault', 'faulted', 'faults', 'faulty', 'fear', 'fears',
'felonies', 'felonious', 'felony', 'fictitious', 'fined', 'fines', 'fired', 'firing', 'flaw',
'flawed', 'flaws', 'forbid', 'forbidden', 'forbidding', 'forbids', 'force', 'forced', 'forcing',
'foreclose', 'foreclosed', 'forecloses', 'foreclosing', 'foreclosure', 'foreclosures', 'forego',
'foregoes', 'foregone', 'forestall', 'forestalled', 'forestalling', 'forestalls', 'forfeit',
'forfeited', 'forfeiting', 'forfeits', 'forfeiture', 'forfeitures', 'forgers', 'forgery',
'fraud', 'frauds', 'fraudulence', 'fraudulent', 'fraudulently', 'frivolous', 'frivolously',
'frustrate', 'frustrated', 'frustrates', 'frustrating', 'frustratingly', 'frustration',
'frustrations', 'fugitive', 'fugitives', 'gratuitous', 'gratuitously', 'grievance', 'grievances',
'grossly', 'groundless', 'guilty', 'halt', 'halted', 'hamper', 'hampered', 'hampering',
'hampers', 'harass', 'harassed', 'harassing', 'harassment', 'hardship', 'hardships', 'harm',
'harmed', 'harmful', 'harmfully', 'harming', 'harms', 'harsh', 'harsher', 'harshest', 'harshly',
'harshness', 'hazard', 'hazardous', 'hazards', 'hinder', 'hindered', 'hindering', 'hinders',
'hindrance', 'hindrances', 'hostile', 'hostility', 'hurt', 'hurting', 'idle', 'idled', 'idling',
'ignore', 'ignored', 'ignores', 'ignoring', 'ill', 'illegal', 'illegalities', 'illegality',
'illegally', 'illegible', 'illicit', 'illicitly', 'illiquid', 'illiquidity', 'imbalance',
'imbalances', 'immature', 'immoral', 'impair', 'impaired', 'impairing', 'impairment',
'impairments', 'impairs', 'impasse', 'impasses', 'impede', 'impeded', 'impedes', 'impediment',
'impediments', 'impeding', 'impending', 'imperative', 'imperfection', 'imperfections', 'imperil',
'impermissible', 'implicate', 'implicated', 'implicates', 'implicating', 'impossibility',
'impossible', 'impound', 'impounded', 'impounding', 'impounds', 'impracticable', 'impractical',
'impracticalities', 'impracticality', 'imprisonment', 'improper', 'improperly', 'improprieties',
'impropriety', 'imprudent', 'imprudently', 'inability', 'inaccessible', 'inaccuracies',
'inaccuracy', 'inaccurate', 'inaccurately', 'inaction', 'inactions', 'inactivate', 'inactivated',
'inactivates', 'inactivating', 'inactivation', 'inactivations', 'inactivity', 'inadequacies',
'inadequacy', 'inadequate', 'inadequately', 'inadvertent', 'inadvertently', 'inadvisability',
'inadvisable', 'inappropriate', 'inappropriately', 'inattention', 'incapable', 'incapacitated',
'incapacity', 'incarcerate', 'incarcerated', 'incarcerates', 'incarcerating', 'incarceration',
'incarcerations', 'incidence', 'incidences', 'incident', 'incidents', 'incompatibilities',
'incompatibility', 'incompatible', 'incompetence', 'incompetency', 'incompetent',
'incompetently', 'incompetents', 'incomplete', 'incompletely', 'incompleteness', 'inconclusive',
'inconsistencies', 'inconsistency', 'inconsistent', 'inconsistently', 'inconvenience',
'inconveniences', 'inconvenient', 'incorrect', 'incorrectly', 'incorrectness', 'indecency',
'indecent', 'indefeasible', 'indefeasibly', 'indict', 'indictable', 'indicted', 'indicting',
'indictment', 'indictments', 'ineffective', 'ineffectively', 'ineffectiveness', 'inefficiencies',
'inefficiency', 'inefficient', 'inefficiently', 'ineligibility', 'ineligible', 'inequitable',
'inequitably', 'inequities', 'inequity', 'inevitable', 'inexperience', 'inexperienced',
'inferior', 'inflicted', 'infraction', 'infractions', 'infringe', 'infringed', 'infringement',
'infringements', 'infringes', 'infringing', 'inhibited', 'inimical', 'injunction', 'injunctions',
'injure', 'injured', 'injures', 'injuries', 'injuring', 'injurious', 'injury', 'inordinate',
'inordinately', 'inquiry', 'insecure', 'insensitive', 'insolvencies', 'insolvency', 'insolvent',
'instability', 'insubordination', 'insufficiency', 'insufficient', 'insufficiently',
'insurrection', 'insurrections', 'intentional', 'interfere', 'interfered', 'interference',
'interferences', 'interferes', 'interfering', 'intermittent', 'intermittently', 'interrupt',
'interrupted', 'interrupting', 'interruption', 'interruptions', 'interrupts', 'intimidation',
'intrusion', 'invalid', 'invalidate', 'invalidated', 'invalidates', 'invalidating',
'invalidation', 'invalidity', 'investigate', 'investigated', 'investigates', 'investigating',
'investigation', 'investigations', 'involuntarily', 'involuntary', 'irreconcilable',
'irreconcilably', 'irrecoverable', 'irrecoverably', 'irregular', 'irregularities',
'irregularity', 'irregularly', 'irreparable', 'irreparably', 'irreversible', 'jeopardize',
'jeopardized', 'justifiable', 'kickback', 'kickbacks', 'knowingly', 'lack', 'lacked', 'lacking',
'lackluster', 'lacks', 'lag', 'lagged', 'lagging', 'lags', 'lapse', 'lapsed', 'lapses',
'lapsing', 'late', 'laundering', 'layoff', 'layoffs', 'lie', 'limitation', 'limitations',
'lingering', 'liquidate', 'liquidated', 'liquidates', 'liquidating', 'liquidation',
'liquidations', 'liquidator', 'liquidators', 'litigant', 'litigants', 'litigate', 'litigated',
'litigates', 'litigating', 'litigation', 'litigations', 'lockout', 'lockouts', 'lose', 'loses',
'losing', 'loss', 'losses', 'lost', 'lying', 'malfeasance', 'malfunction', 'malfunctioned',
'malfunctioning', 'malfunctions', 'malice', 'malicious', 'maliciously', 'malpractice',
'manipulate', 'manipulated', 'manipulates', 'manipulating', 'manipulation', 'manipulations',
'manipulative', 'markdown', 'markdowns', 'misapplication', 'misapplications', 'misapplied',
'misapplies', 'misapply', 'misapplying', 'misappropriate', 'misappropriated', 'misappropriates',
'misappropriating', 'misappropriation', 'misappropriations', 'misbranded', 'miscalculate',
'miscalculated', 'miscalculates', 'miscalculating', 'miscalculation', 'miscalculations',
'mischaracterization', 'mischief', 'misclassification', 'misclassifications', 'misclassified',
'misclassify', 'miscommunication', 'misconduct', 'misdated', 'misdemeanor', 'misdemeanors',
'misdirected', 'mishandle', 'mishandled', 'mishandles', 'mishandling', 'misinform',
'misinformation', 'misinformed', 'misinforming', 'misinforms', 'misinterpret',
'misinterpretation', 'misinterpretations', 'misinterpreted', 'misinterpreting', 'misinterprets',
'misjudge', 'misjudged', 'misjudges', 'misjudging', 'misjudgment', 'misjudgments', 'mislabel',
'mislabeled', 'mislabeling', 'mislabelled', 'mislabels', 'mislead', 'misleading', 'misleadingly',
'misleads', 'misled', 'mismanage', 'mismanaged', 'mismanagement', 'mismanages', 'mismanaging',
'mismatch', 'mismatched', 'mismatches', 'mismatching', 'misplaced', 'misprice', 'mispricing',
'mispricings', 'misrepresent', 'misrepresentation', 'misrepresentations', 'misrepresented',
'misrepresenting', 'misrepresents', 'miss', 'missed', 'misses', 'misstate', 'misstated',
'misstatement', 'misstatements', 'misstates', 'misstating', 'misstep', 'missteps', 'mistake',
'mistaken', 'mistakenly', 'mistakes', 'mistaking', 'mistrial', 'mistrials', 'misunderstand',
'misunderstanding', 'misunderstandings', 'misunderstood', 'misuse', 'misused', 'misuses',
'misusing', 'monopolistic', 'monopolists', 'monopolization', 'monopolize', 'monopolized',
'monopolizes', 'monopolizing', 'monopoly', 'moratoria', 'moratorium', 'moratoriums',
'mothballed', 'mothballing', 'negative', 'negatively', 'negatives', 'neglect', 'neglected',
'neglectful', 'neglecting', 'neglects', 'negligence', 'negligences', 'negligent', 'negligently',
'nonattainment', 'noncompetitive', 'noncompliance', 'noncompliances', 'noncompliant',
'noncomplying', 'nonconforming', 'nonconformities', 'nonconformity', 'nondisclosure',
'nonfunctional', 'nonpayment', 'nonpayments', 'nonperformance', 'nonperformances',
'nonperforming', 'nonproducing', 'nonproductive', 'nonrecoverable', 'nonrenewal', 'nuisance',
'nuisances', 'nullification', 'nullifications', 'nullified', 'nullifies', 'nullify',
'nullifying', 'objected', 'objecting', 'objection', 'objectionable', 'objectionably',
'objections', 'obscene', 'obscenity', 'obsolescence', 'obsolete', 'obstacle', 'obstacles',
'obstruct', 'obstructed', 'obstructing', 'obstruction', 'obstructions', 'offence', 'offences',
'offend', 'offended', 'offender', 'offenders', 'offending', 'offends', 'omission', 'omissions',
'omit', 'omits', 'omitted', 'omitting', 'onerous', 'opportunistic', 'opportunistically',
'oppose', 'opposed', 'opposes', 'opposing', 'opposition', 'oppositions', 'outage', 'outages',
'outdated', 'outmoded', 'overage', 'overages', 'overbuild', 'overbuilding', 'overbuilds',
'overbuilt', 'overburden', 'overburdened', 'overburdening', 'overcapacities', 'overcapacity',
'overcharge', 'overcharged', 'overcharges', 'overcharging', 'overcome', 'overcomes',
'overcoming', 'overdue', 'overestimate', 'overestimated', 'overestimates', 'overestimating',
'overestimation', 'overestimations', 'overload', 'overloaded', 'overloading', 'overloads',
'overlook', 'overlooked', 'overlooking', 'overlooks', 'overpaid', 'overpayment', 'overpayments',
'overproduced', 'overproduces', 'overproducing', 'overproduction', 'overrun', 'overrunning',
'overruns', 'overshadow', 'overshadowed', 'overshadowing', 'overshadows', 'overstate',
'overstated', 'overstatement', 'overstatements', 'overstates', 'overstating', 'oversupplied',
'oversupplies', 'oversupply', 'oversupplying', 'overtly', 'overturn', 'overturned',
'overturning', 'overturns', 'overvalue', 'overvalued', 'overvaluing', 'panic', 'panics',
'penalize', 'penalized', 'penalizes', 'penalizing', 'penalties', 'penalty', 'peril', 'perils',
'perjury', 'perpetrate', 'perpetrated', 'perpetrates', 'perpetrating', 'perpetration', 'persist',
'persisted', 'persistence', 'persistent', 'persistently', 'persisting', 'persists', 'pervasive',
'pervasively', 'pervasiveness', 'petty', 'picket', 'picketed', 'picketing', 'plaintiff',
'plaintiffs', 'plea', 'plead', 'pleaded', 'pleading', 'pleadings', 'pleads', 'pleas', 'pled',
'poor', 'poorly', 'poses', 'posing', 'postpone', 'postponed', 'postponement', 'postponements',
'postpones', 'postponing', 'precipitated', 'precipitous', 'precipitously', 'preclude',
'precluded', 'precludes', 'precluding', 'predatory', 'prejudice', 'prejudiced', 'prejudices',
'prejudicial', 'prejudicing', 'premature', 'prematurely', 'pressing', 'pretrial', 'preventing',
'prevention', 'prevents', 'problem', 'problematic', 'problematical', 'problems', 'prolong',
'prolongation', 'prolongations', 'prolonged', 'prolonging', 'prolongs', 'prone', 'prosecute',
'prosecuted', 'prosecutes', 'prosecuting', 'prosecution', 'prosecutions', 'protest', 'protested',
'protester', 'protesters', 'protesting', 'protestor', 'protestors', 'protests', 'protracted',
'protraction', 'provoke', 'provoked', 'provokes', 'provoking', 'punished', 'punishes',
'punishing', 'punishment', 'punishments', 'punitive', 'purport', 'purported', 'purportedly',
'purporting', 'purports', 'question', 'questionable', 'questionably', 'questioned',
'questioning', 'questions', 'quit', 'quitting', 'racketeer', 'racketeering', 'rationalization',
'rationalizations', 'rationalize', 'rationalized', 'rationalizes', 'rationalizing',
'reassessment', 'reassessments', 'reassign', 'reassigned', 'reassigning', 'reassignment',
'reassignments', 'reassigns', 'recall', 'recalled', 'recalling', 'recalls', 'recession',
'recessionary', 'recessions', 'reckless', 'recklessly', 'recklessness', 'redact', 'redacted',
'redacting', 'redaction', 'redactions', 'redefault', 'redefaulted', 'redefaults', 'redress',
'redressed', 'redresses', 'redressing', 'refusal', 'refusals', 'refuse', 'refused', 'refuses',
'refusing', 'reject', 'rejected', 'rejecting', 'rejection', 'rejections', 'rejects',
'relinquish', 'relinquished', 'relinquishes', 'relinquishing', 'relinquishment',
'relinquishments', 'reluctance', 'reluctant', 'renegotiate', 'renegotiated', 'renegotiates',
'renegotiating', 'renegotiation', 'renegotiations', 'renounce', 'renounced', 'renouncement',
'renouncements', 'renounces', 'renouncing', 'reparation', 'reparations', 'repossessed',
'repossesses', 'repossessing', 'repossession', 'repossessions', 'repudiate', 'repudiated',
'repudiates', 'repudiating', 'repudiation', 'repudiations', 'resign', 'resignation',
'resignations', 'resigned', 'resigning', 'resigns', 'restate', 'restated', 'restatement',
'restatements', 'restates', 'restating', 'restructure', 'restructured', 'restructures',
'restructuring', 'restructurings', 'retaliate', 'retaliated', 'retaliates', 'retaliating',
'retaliation', 'retaliations', 'retaliatory', 'retribution', 'retributions', 'revocation',
'revocations', 'revoke', 'revoked', 'revokes', 'revoking', 'ridicule', 'ridiculed', 'ridicules',
'ridiculing', 'riskier', 'riskiest', 'risky', 'sabotage', 'sacrifice', 'sacrificed',
'sacrifices', 'sacrificial', 'sacrificing', 'scandalous', 'scandals', 'scrutinize',
'scrutinized', 'scrutinizes', 'scrutinizing', 'scrutiny', 'secrecy', 'seize', 'seized', 'seizes',
'seizing', 'sentenced', 'sentencing', 'serious', 'seriously', 'seriousness', 'setback',
'setbacks', 'sever', 'severe', 'severed', 'severely', 'severities', 'severity', 'sharply',
'shocked', 'shortage', 'shortages', 'shortfall', 'shortfalls', 'shrinkage', 'shrinkages', 'shut',
'shutdown', 'shutdowns', 'shuts', 'shutting', 'slander', 'slandered', 'slanderous', 'slanders',
'slippage', 'slippages', 'slow', 'slowdown', 'slowdowns', 'slowed', 'slower', 'slowest',
'slowing', 'slowly', 'slowness', 'sluggish', 'sluggishly', 'sluggishness', 'solvencies',
'solvency', 'spam', 'spammers', 'spamming', 'staggering', 'stagnant', 'stagnate', 'stagnated',
'stagnates', 'stagnating', 'stagnation', 'standstill', 'standstills', 'stolen', 'stoppage',
'stoppages', 'stopped', 'stopping', 'stops', 'strain', 'strained', 'straining', 'strains',
'stress', 'stressed', 'stresses', 'stressful', 'stressing', 'stringent', 'subjected',
'subjecting', 'subjection', 'subpoena', 'subpoenaed', 'subpoenas', 'substandard', 'sue', 'sued',
'sues', 'suffer', 'suffered', 'suffering', 'suffers', 'suing', 'summoned', 'summoning',
'summons', 'summonses', 'susceptibility', 'susceptible', 'suspect', 'suspected', 'suspects',
'suspend', 'suspended', 'suspending', 'suspends', 'suspension', 'suspensions', 'suspicion',
'suspicions', 'suspicious', 'suspiciously', 'taint', 'tainted', 'tainting', 'taints', 'tampered',
'tense', 'terminate', 'terminated', 'terminates', 'terminating', 'termination', 'terminations',
'testify', 'testifying', 'threat', 'threaten', 'threatened', 'threatening', 'threatens',
'threats', 'tightening', 'tolerate', 'tolerated', 'tolerates', 'tolerating', 'toleration',
'tortuous', 'tortuously', 'tragedies', 'tragedy', 'tragic', 'tragically', 'traumatic', 'trouble',
'troubled', 'troubles', 'turbulence', 'turmoil', 'unable', 'unacceptable', 'unacceptably',
'unaccounted', 'unannounced', 'unanticipated', 'unapproved', 'unattractive', 'unauthorized',
'unavailability', 'unavailable', 'unavoidable', 'unavoidably', 'unaware', 'uncollectable',
'uncollected', 'uncollectibility', 'uncollectible', 'uncollectibles', 'uncompetitive',
'uncompleted', 'unconscionable', 'unconscionably', 'uncontrollable', 'uncontrollably',
'uncontrolled', 'uncorrected', 'uncover', 'uncovered', 'uncovering', 'uncovers', 'undeliverable',
'undelivered', 'undercapitalized', 'undercut', 'undercuts', 'undercutting', 'underestimate',
'underestimated', 'underestimates', 'underestimating', 'underestimation', 'underfunded',
'underinsured', 'undermine', 'undermined', 'undermines', 'undermining', 'underpaid',
'underpayment', 'underpayments', 'underpays', 'underperform', 'underperformance',
'underperformed', 'underperforming', 'underperforms', 'underproduced', 'underproduction',
'underreporting', 'understate', 'understated', 'understatement', 'understatements',
'understates', 'understating', 'underutilization', 'underutilized', 'undesirable', 'undesired',
'undetected', 'undetermined', 'undisclosed', 'undocumented', 'undue', 'unduly', 'uneconomic',
'uneconomical', 'uneconomically', 'unemployed', 'unemployment', 'unethical', 'unethically',
'unexcused', 'unexpected', 'unexpectedly', 'unfair', 'unfairly', 'unfavorability', 'unfavorable',
'unfavorably', 'unfavourable', 'unfeasible', 'unfit', 'unfitness', 'unforeseeable', 'unforeseen',
'unforseen', 'unfortunate', 'unfortunately', 'unfounded', 'unfriendly', 'unfulfilled',
'unfunded', 'uninsured', 'unintended', 'unintentional', 'unintentionally', 'unjust',
'unjustifiable', 'unjustifiably', 'unjustified', 'unjustly', 'unknowing', 'unknowingly',
'unlawful', 'unlawfully', 'unlicensed', 'unliquidated', 'unmarketable', 'unmerchantable',
'unmeritorious', 'unnecessarily', 'unnecessary', 'unneeded', 'unobtainable', 'unoccupied',
'unpaid', 'unperformed', 'unplanned', 'unpopular', 'unpredictability', 'unpredictable',
'unpredictably', 'unpredicted', 'unproductive', 'unprofitability', 'unprofitable', 'unqualified',
'unrealistic', 'unreasonable', 'unreasonableness', 'unreasonably', 'unreceptive',
'unrecoverable', 'unrecovered', 'unreimbursed', 'unreliable', 'unremedied', 'unreported',
'unresolved', 'unrest', 'unsafe', 'unsalable', 'unsaleable', 'unsatisfactory', 'unsatisfied',
'unsavory', 'unscheduled', 'unsellable', 'unsold', 'unsound', 'unstabilized', 'unstable',
'unsubstantiated', 'unsuccessful', 'unsuccessfully', 'unsuitability', 'unsuitable', 'unsuitably',
'unsuited', 'unsure', 'unsuspected', 'unsuspecting', 'unsustainable', 'untenable', 'untimely',
'untrusted', 'untruth', 'untruthful', 'untruthfully', 'untruthfulness', 'untruths', 'unusable',
'unwanted', 'unwarranted', 'unwelcome', 'unwilling', 'unwillingness', 'upset', 'urgency',
'urgent', 'usurious', 'usurp', 'usurped', 'usurping', 'usurps', 'usury', 'vandalism', 'verdict',
'verdicts', 'vetoed', 'victims', 'violate', 'violated', 'violates', 'violating', 'violation',
'violations', 'violative', 'violator', 'violators', 'violence', 'violent', 'violently',
'vitiate', 'vitiated', 'vitiates', 'vitiating', 'vitiation', 'voided', 'voiding', 'volatile',
'volatility', 'vulnerabilities', 'vulnerability', 'vulnerable', 'vulnerably', 'warn', 'warned',
'warning', 'warnings', 'warns', 'wasted', 'wasteful', 'wasting', 'weak', 'weaken', 'weakened',
'weakening', 'weakens', 'weaker', 'weakest', 'weakly', 'weakness', 'weaknesses', 'willfully',
'worries', 'worry', 'worrying', 'worse', 'worsen', 'worsened', 'worsening', 'worsens', 'worst',
'worthless', 'writedown', 'writedowns', 'writeoff', 'writeoffs', 'wrong', 'wrongdoing',
'wrongdoings', 'wrongful', 'wrongfully', 'wrongly'],
'Positive': ['able', 'abundance', 'abundant', 'acclaimed', 'accomplish', 'accomplished', 'accomplishes',
'accomplishing', 'accomplishment', 'accomplishments', 'achieve', 'achieved', 'achievement',
'achievements', 'achieves', 'achieving', 'adequately', 'advancement', 'advancements', 'advances',
'advancing', 'advantage', 'advantaged', 'advantageous', 'advantageously', 'advantages',
'alliance', 'alliances', 'assure', 'assured', 'assures', 'assuring', 'attain', 'attained',
'attaining', 'attainment', 'attainments', 'attains', 'attractive', 'attractiveness', 'beautiful',
'beautifully', 'beneficial', 'beneficially', 'benefit', 'benefited', 'benefiting', 'benefitted',
'benefitting', 'best', 'better', 'bolstered', 'bolstering', 'bolsters', 'boom', 'booming',
'boost', 'boosted', 'breakthrough', 'breakthroughs', 'brilliant', 'charitable', 'collaborate',
'collaborated', 'collaborates', 'collaborating', 'collaboration', 'collaborations',
'collaborative', 'collaborator', 'collaborators', 'compliment', 'complimentary', 'complimented',
'complimenting', 'compliments', 'conclusive', 'conclusively', 'conducive', 'confident',
'constructive', 'constructively', 'courteous', 'creative', 'creatively', 'creativeness',
'creativity', 'delight', 'delighted', 'delightful', 'delightfully', 'delighting', 'delights',
'dependability', 'dependable', 'desirable', 'desired', 'despite', 'destined', 'diligent',
'diligently', 'distinction', 'distinctions', 'distinctive', 'distinctively', 'distinctiveness',
'dream', 'easier', 'easily', 'easy', 'effective', 'efficiencies', 'efficiency', 'efficient',
'efficiently', 'empower', 'empowered', 'empowering', 'empowers', 'enable', 'enabled', 'enables',
'enabling', 'encouraged', 'encouragement', 'encourages', 'encouraging', 'enhance', 'enhanced',
'enhancement', 'enhancements', 'enhances', 'enhancing', 'enjoy', 'enjoyable', 'enjoyably',
'enjoyed', 'enjoying', 'enjoyment', 'enjoys', 'enthusiasm', 'enthusiastic', 'enthusiastically',
'excellence', 'excellent', 'excelling', 'excels', 'exceptional', 'exceptionally', 'excited',
'excitement', 'exciting', 'exclusive', 'exclusively', 'exclusiveness', 'exclusives',
'exclusivity', 'exemplary', 'fantastic', 'favorable', 'favorably', 'favored', 'favoring',
'favorite', 'favorites', 'friendly', 'gain', 'gained', 'gaining', 'gains', 'good', 'great',
'greater', 'greatest', 'greatly', 'greatness', 'happiest', 'happily', 'happiness', 'happy',
'highest', 'honor', 'honorable', 'honored', 'honoring', 'honors', 'ideal', 'impress',
'impressed', 'impresses', 'impressing', 'impressive', 'impressively', 'improve', 'improved',
'improvement', 'improvements', 'improves', 'improving', 'incredible', 'incredibly',
'influential', 'informative', 'ingenuity', 'innovate', 'innovated', 'innovates', 'innovating',
'innovation', 'innovations', 'innovative', 'innovativeness', 'innovator', 'innovators',
'insightful', 'inspiration', 'inspirational', 'integrity', 'invent', 'invented', 'inventing',
'invention', 'inventions', 'inventive', 'inventiveness', 'inventor', 'inventors', 'leadership',
'leading', 'loyal', 'lucrative', 'meritorious', 'opportunities', 'opportunity', 'optimistic',
'outperform', 'outperformed', 'outperforming', 'outperforms', 'perfect', 'perfected',
'perfectly', 'perfects', 'pleasant', 'pleasantly', 'pleased', 'pleasure', 'plentiful', 'popular',
'popularity', 'positive', 'positively', 'preeminence', 'preeminent', 'premier', 'premiere',
'prestige', 'prestigious', 'proactive', 'proactively', 'proficiency', 'proficient',
'proficiently', 'profitability', 'profitable', 'profitably', 'progress', 'progressed',
'progresses', 'progressing', 'prospered', 'prospering', 'prosperity', 'prosperous', 'prospers',
'rebound', 'rebounded', 'rebounding', 'receptive', 'regain', 'regained', 'regaining', 'resolve',
'revolutionize', 'revolutionized', 'revolutionizes', 'revolutionizing', 'reward', 'rewarded',
'rewarding', 'rewards', 'satisfaction', 'satisfactorily', 'satisfactory', 'satisfied',
'satisfies', 'satisfy', 'satisfying', 'smooth', 'smoothing', 'smoothly', 'smooths', 'solves',
'solving', 'spectacular', 'spectacularly', 'stability', 'stabilization', 'stabilizations',
'stabilize', 'stabilized', 'stabilizes', 'stabilizing', 'stable', 'strength', 'strengthen',
'strengthened', 'strengthening', 'strengthens', 'strengths', 'strong', 'stronger', 'strongest',
'succeed', 'succeeded', 'succeeding', 'succeeds', 'success', 'successes', 'successful',
'successfully', 'superior', 'surpass', 'surpassed', 'surpasses', 'surpassing', 'transparency',
'tremendous', 'tremendously', 'unmatched', 'unparalleled', 'unsurpassed', 'upturn', 'upturns',
'valuable', 'versatile', 'versatility', 'vibrancy', 'vibrant', 'win', 'winner', 'winners',
'winning', 'worthy']}
# Henry's (2008) Word List
# Henry, Elaine. “Are Investors Influenced By How Earnings Press Releases Are Written.” The Journal of Business
# Communication (1973) 45, no. 4 (2008): 363–407.
hdict = {'Negative': ['negative', 'negatives', 'fail', 'fails', 'failing', 'failure', 'weak', 'weakness', 'weaknesses',
'difficult', 'difficulty', 'hurdle', 'hurdles', 'obstacle', 'obstacles', 'slump', 'slumps',
'slumping', 'slumped', 'uncertain', 'uncertainty', 'unsettled', 'unfavorable', 'downturn',
'depressed', 'disappoint', 'disappoints', 'disappointing', 'disappointed', 'disappointment',
'risk', 'risks', 'risky', 'threat', 'threats', 'penalty', 'penalties', 'down', 'decrease',
'decreases', 'decreasing', 'decreased', 'decline', 'declines', 'declining', 'declined', 'fall',
'falls', 'falling', 'fell', 'fallen', 'drop', 'drops', 'dropping', 'dropped', 'deteriorate',
'deteriorates', 'deteriorating', 'deteriorated', 'worsen', 'worsens', 'worsening', 'weaken',
'weakens', 'weakening', 'weakened', 'worse', 'worst', 'low', 'lower', 'lowest', 'less', 'least',
'smaller', 'smallest', 'shrink', 'shrinks', 'shrinking', 'shrunk', 'below', 'under', 'challenge',
'challenges', 'challenging', 'challenged'],
'Positive': ['positive', 'positives', 'success', 'successes', 'successful', 'succeed', 'succeeds',
'succeeding', 'succeeded', 'accomplish', 'accomplishes', 'accomplishing', 'accomplished',
'accomplishment', 'accomplishments', 'strong', 'strength', 'strengths', 'certain', 'certainty',
'definite', 'solid', 'excellent', 'good', 'leading', 'achieve', 'achieves', 'achieved',
'achieving', 'achievement', 'achievements', 'progress', 'progressing', 'deliver', 'delivers',
'delivered', 'delivering', 'leader', 'leading', 'pleased', 'reward', 'rewards', 'rewarding',
'rewarded', 'opportunity', 'opportunities', 'enjoy', 'enjoys', 'enjoying', 'enjoyed',
'encouraged', 'encouraging', 'up', 'increase', 'increases', 'increasing', 'increased', 'rise',
'rises', 'rising', 'rose', 'risen', 'improve', 'improves', 'improving', 'improved', 'improvement',
'improvements', 'strengthen', 'strengthens', 'strengthening', 'strengthened', 'stronger',
'strongest', 'better', 'best', 'more', 'most', 'above', 'record', 'high', 'higher', 'highest',
'greater', 'greatest', 'larger', 'largest', 'grow', 'grows', 'growing', 'grew', 'grown', 'growth',
'expand', 'expands', 'expanding', 'expanded', 'expansion', 'exceed', 'exceeds', 'exceeded',
'exceeding', 'beat', 'beats', 'beating']}
negate = ["aint", "arent", "cannot", "cant", "couldnt", "darent", "didnt", "doesnt", "ain't", "aren't", "can't",
"couldn't", "daren't", "didn't", "doesn't", "dont", "hadnt", "hasnt", "havent", "isnt", "mightnt", "mustnt",
"neither", "don't", "hadn't", "hasn't", "haven't", "isn't", "mightn't", "mustn't", "neednt", "needn't",
"never", "none", "nope", "nor", "not", "nothing", "nowhere", "oughtnt", "shant", "shouldnt", "wasnt",
"werent", "oughtn't", "shan't", "shouldn't", "wasn't", "weren't", "without", "wont", "wouldnt", "won't",
"wouldn't", "rarely", "seldom", "despite", "no", "nobody"]
def negated(word):
"""
Determine if preceding word is a negation word
"""
if word.lower() in negate:
return True
else:
return False
def tone_count_with_negation_check(dict, article):
"""
Count positive and negative words with negation check. Account for simple negation only for positive words.
Simple negation is taken to be observations of one of negate words occurring within three words
preceding a positive words.
"""
pos_count = 0
neg_count = 0
'''
pos_words = []
neg_words = []
'''
input_words = re.findall(r'\b([a-zA-Z]+n\'t|[a-zA-Z]+\'s|[a-zA-Z]+)\b', article.lower())
word_count = len(input_words)
for i in range(0, word_count):
if input_words[i] in dict['Negative']:
neg_count += 1
#neg_words.append(input_words[i])
if input_words[i] in dict['Positive']:
if i >= 3:
if negated(input_words[i - 1]) or negated(input_words[i - 2]) or negated(input_words[i - 3]):
neg_count += 1
#neg_words.append(input_words[i] + ' (with negation)')
else:
pos_count += 1
#pos_words.append(input_words[i])
elif i == 2:
if negated(input_words[i - 1]) or negated(input_words[i - 2]):
neg_count += 1
#neg_words.append(input_words[i] + ' (with negation)')
else:
pos_count += 1
#pos_words.append(input_words[i])
elif i == 1:
if negated(input_words[i - 1]):
neg_count += 1
#neg_words.append(input_words[i] + ' (with negation)')
else:
pos_count += 1
#pos_words.append(input_words[i])
elif i == 0:
pos_count += 1
#pos_words.append(input_words[i])
'''
print('The results with negation check:', end='\n\n')
print('The # of positive words:', pos_count)
print('The # of negative words:', neg_count)
print('The list of found positive words:', pos_words)
print('The list of found negative words:', neg_words)
print('Word count:', word_count)
print('\n', end='')
'''
results = [word_count, pos_count, neg_count] #, pos_words, neg_words
return results
write_to_file('./loughran_mcdonald_score.txt', '%s\t%s\t%s\t%s\t%s\t%s\t%s\n' %
('article_link', 'ticker', 'date', 'ticker_from_text', 'word_count',
'pos_count', 'neg_count'))
stock_tickers = pd.read_csv('./earnings_to_search.csv')
for index, row in stock_tickers.iterrows():
article_link = row['article']
ticker = row['ticker']
date = row['date']
word_count = 0
pos_count = 0
neg_count = 0
try:
text_data, ticker_from_text = read_file('.%s.txt' % article_link)
start = False
end = False
if len(text_data) > 0:
for text in text_data:
for sentence in text:
if not start:
if sentence == 'unknown speaker' or \
sentence == 'operator' or 'good' in sentence or \
'hello' in sentence or 'thank' in sentence or \
'welcome' in sentence:
start = True
if sentence == 'question-and-answer session':
end = True
break
if start and not end:
result = tone_count_with_negation_check(lmdict, sentence.strip())
word_count += result[0]
pos_count += result[1]
neg_count += result[2]
write_to_file('./loughran_mcdonald_score.txt', '%s\t%s\t%s\t%s\t%s\t%s\t%s\n' %
(article_link, ticker, date, ticker_from_text, word_count,
pos_count, neg_count))
except Exception as e:
print(e)