├── .gitignore ├── .travis.yml ├── AFINN-111.json ├── AFINN-README.txt ├── README.md ├── SentiWS.txt ├── german.json ├── package.json ├── src └── index.js └── test ├── testEnglish.js └── testGerman.js /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Node template 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | 13 | # Directory for instrumented libs generated by jscoverage/JSCover 14 | lib-cov 15 | 16 | # Coverage directory used by tools like istanbul 17 | coverage 18 | 19 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 20 | .grunt 21 | 22 | # node-waf configuration 23 | .lock-wscript 24 | 25 | # Compiled binary addons (http://nodejs.org/api/addons.html) 26 | build/Release 27 | 28 | # Dependency directory 29 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git 30 | node_modules 31 | .idea 32 | Trash 33 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "5.0" 4 | - "6.0" 5 | - "10" 6 | after_success: 7 | - npm run-script coverage 8 | -------------------------------------------------------------------------------- /AFINN-111.json: -------------------------------------------------------------------------------- 1 | {"abandon":-2,"abandoned":-2,"abandons":-2,"abducted":-2,"abduction":-2,"abductions":-2,"abhor":-3,"abhorred":-3,"abhorrent":-3,"abhors":-3,"abilities":2,"ability":2,"aboard":1,"absentee":-1,"absentees":-1,"absolve":2,"absolved":2,"absolves":2,"absolving":2,"absorbed":1,"abuse":-3,"abused":-3,"abuses":-3,"abusive":-3,"accept":1,"accepted":1,"accepting":1,"accepts":1,"accident":-2,"accidental":-2,"accidentally":-2,"accidents":-2,"accomplish":2,"accomplished":2,"accomplishes":2,"accusation":-2,"accusations":-2,"accuse":-2,"accused":-2,"accuses":-2,"accusing":-2,"ache":-2,"achievable":1,"aching":-2,"acquit":2,"acquits":2,"acquitted":2,"acquitting":2,"acrimonious":-3,"active":1,"adequate":1,"admire":3,"admired":3,"admires":3,"admiring":3,"admit":-1,"admits":-1,"admitted":-1,"admonish":-2,"admonished":-2,"adopt":1,"adopts":1,"adorable":3,"adore":3,"adored":3,"adores":3,"advanced":1,"advantage":2,"advantages":2,"adventure":2,"adventures":2,"adventurous":2,"affected":-1,"affection":3,"affectionate":3,"afflicted":-1,"affronted":-1,"afraid":-2,"aggravate":-2,"aggravated":-2,"aggravates":-2,"aggravating":-2,"aggression":-2,"aggressions":-2,"aggressive":-2,"aghast":-2,"agog":2,"agonise":-3,"agonised":-3,"agonises":-3,"agonising":-3,"agonize":-3,"agonized":-3,"agonizes":-3,"agonizing":-3,"agree":1,"agreeable":2,"agreed":1,"agreement":1,"agrees":1,"alarm":-2,"alarmed":-2,"alarmist":-2,"alarmists":-2,"alas":-1,"alert":-1,"alienation":-2,"alive":1,"allergic":-2,"allow":1,"alone":-2,"amaze":2,"amazed":2,"amazes":2,"amazing":4,"ambitious":2,"ambivalent":-1,"amuse":3,"amused":3,"amusement":3,"amusements":3,"anger":-3,"angers":-3,"angry":-3,"anguish":-3,"anguished":-3,"animosity":-2,"annoy":-2,"annoyance":-2,"annoyed":-2,"annoying":-2,"annoys":-2,"antagonistic":-2,"anti":-1,"anticipation":1,"anxiety":-2,"anxious":-2,"apathetic":-3,"apathy":-3,"apeshit":-3,"apocalyptic":-2,"apologise":-1,"apologised":-1,"apologises":-1,"apologising":-1,"apologize":-1,"apologized":-1,"apologizes":-1,"apologizing":-1,"apology":-1,"appalled":-2,"appalling":-2,"appease":2,"appeased":2,"appeases":2,"appeasing":2,"applaud":2,"applauded":2,"applauding":2,"applauds":2,"applause":2,"appreciate":2,"appreciated":2,"appreciates":2,"appreciating":2,"appreciation":2,"apprehensive":-2,"approval":2,"approved":2,"approves":2,"ardent":1,"arrest":-2,"arrested":-3,"arrests":-2,"arrogant":-2,"ashame":-2,"ashamed":-2,"ass":-4,"assassination":-3,"assassinations":-3,"asset":2,"assets":2,"assfucking":-4,"asshole":-4,"astonished":2,"astound":3,"astounded":3,"astounding":3,"astoundingly":3,"astounds":3,"attack":-1,"attacked":-1,"attacking":-1,"attacks":-1,"attract":1,"attracted":1,"attracting":2,"attraction":2,"attractions":2,"attracts":1,"audacious":3,"authority":1,"avert":-1,"averted":-1,"averts":-1,"avid":2,"avoid":-1,"avoided":-1,"avoids":-1,"await":-1,"awaited":-1,"awaits":-1,"award":3,"awarded":3,"awards":3,"awesome":4,"awful":-3,"awkward":-2,"axe":-1,"axed":-1,"backed":1,"backing":2,"backs":1,"bad":-3,"badass":-3,"badly":-3,"bailout":-2,"bamboozle":-2,"bamboozled":-2,"bamboozles":-2,"ban":-2,"banish":-1,"bankrupt":-3,"bankster":-3,"banned":-2,"bargain":2,"barrier":-2,"bastard":-5,"bastards":-5,"battle":-1,"battles":-1,"beaten":-2,"beatific":3,"beating":-1,"beauties":3,"beautiful":3,"beautifully":3,"beautify":3,"belittle":-2,"belittled":-2,"beloved":3,"benefit":2,"benefits":2,"benefitted":2,"benefitting":2,"bereave":-2,"bereaved":-2,"bereaves":-2,"bereaving":-2,"best":3,"betray":-3,"betrayal":-3,"betrayed":-3,"betraying":-3,"betrays":-3,"better":2,"bias":-1,"biased":-2,"big":1,"bitch":-5,"bitches":-5,"bitter":-2,"bitterly":-2,"bizarre":-2,"blah":-2,"blame":-2,"blamed":-2,"blames":-2,"blaming":-2,"bless":2,"blesses":2,"blessing":3,"blind":-1,"bliss":3,"blissful":3,"blithe":2,"block":-1,"blockbuster":3,"blocked":-1,"blocking":-1,"blocks":-1,"bloody":-3,"blurry":-2,"boastful":-2,"bold":2,"boldly":2,"bomb":-1,"boost":1,"boosted":1,"boosting":1,"boosts":1,"bore":-2,"bored":-2,"boring":-3,"bother":-2,"bothered":-2,"bothers":-2,"bothersome":-2,"boycott":-2,"boycotted":-2,"boycotting":-2,"boycotts":-2,"brainwashing":-3,"brave":2,"breakthrough":3,"breathtaking":5,"bribe":-3,"bright":1,"brightest":2,"brightness":1,"brilliant":4,"brisk":2,"broke":-1,"broken":-1,"brooding":-2,"bullied":-2,"bullshit":-4,"bully":-2,"bullying":-2,"bummer":-2,"buoyant":2,"burden":-2,"burdened":-2,"burdening":-2,"burdens":-2,"calm":2,"calmed":2,"calming":2,"calms":2,"can't stand":-3,"cancel":-1,"cancelled":-1,"cancelling":-1,"cancels":-1,"cancer":-1,"capable":1,"captivated":3,"care":2,"carefree":1,"careful":2,"carefully":2,"careless":-2,"cares":2,"cashing in":-2,"casualty":-2,"catastrophe":-3,"catastrophic":-4,"cautious":-1,"celebrate":3,"celebrated":3,"celebrates":3,"celebrating":3,"censor":-2,"censored":-2,"censors":-2,"certain":1,"chagrin":-2,"chagrined":-2,"challenge":-1,"chance":2,"chances":2,"chaos":-2,"chaotic":-2,"charged":-3,"charges":-2,"charm":3,"charming":3,"charmless":-3,"chastise":-3,"chastised":-3,"chastises":-3,"chastising":-3,"cheat":-3,"cheated":-3,"cheater":-3,"cheaters":-3,"cheats":-3,"cheer":2,"cheered":2,"cheerful":2,"cheering":2,"cheerless":-2,"cheers":2,"cheery":3,"cherish":2,"cherished":2,"cherishes":2,"cherishing":2,"chic":2,"childish":-2,"chilling":-1,"choke":-2,"choked":-2,"chokes":-2,"choking":-2,"clarifies":2,"clarity":2,"clash":-2,"classy":3,"clean":2,"cleaner":2,"clear":1,"cleared":1,"clearly":1,"clears":1,"clever":2,"clouded":-1,"clueless":-2,"cock":-5,"cocksucker":-5,"cocksuckers":-5,"cocky":-2,"coerced":-2,"collapse":-2,"collapsed":-2,"collapses":-2,"collapsing":-2,"collide":-1,"collides":-1,"colliding":-1,"collision":-2,"collisions":-2,"colluding":-3,"combat":-1,"combats":-1,"comedy":1,"comfort":2,"comfortable":2,"comforting":2,"comforts":2,"commend":2,"commended":2,"commit":1,"commitment":2,"commits":1,"committed":1,"committing":1,"compassionate":2,"compelled":1,"competent":2,"competitive":2,"complacent":-2,"complain":-2,"complained":-2,"complains":-2,"comprehensive":2,"conciliate":2,"conciliated":2,"conciliates":2,"conciliating":2,"condemn":-2,"condemnation":-2,"condemned":-2,"condemns":-2,"confidence":2,"confident":2,"conflict":-2,"conflicting":-2,"conflictive":-2,"conflicts":-2,"confuse":-2,"confused":-2,"confusing":-2,"congrats":2,"congratulate":2,"congratulation":2,"congratulations":2,"consent":2,"consents":2,"consolable":2,"conspiracy":-3,"constrained":-2,"contagion":-2,"contagions":-2,"contagious":-1,"contempt":-2,"contemptuous":-2,"contemptuously":-2,"contend":-1,"contender":-1,"contending":-1,"contentious":-2,"contestable":-2,"controversial":-2,"controversially":-2,"convince":1,"convinced":1,"convinces":1,"convivial":2,"cool":1,"cool stuff":3,"cornered":-2,"corpse":-1,"costly":-2,"courage":2,"courageous":2,"courteous":2,"courtesy":2,"cover-up":-3,"coward":-2,"cowardly":-2,"coziness":2,"cramp":-1,"crap":-3,"crash":-2,"crazier":-2,"craziest":-2,"crazy":-2,"creative":2,"crestfallen":-2,"cried":-2,"cries":-2,"crime":-3,"criminal":-3,"criminals":-3,"crisis":-3,"critic":-2,"criticism":-2,"criticize":-2,"criticized":-2,"criticizes":-2,"criticizing":-2,"critics":-2,"cruel":-3,"cruelty":-3,"crush":-1,"crushed":-2,"crushes":-1,"crushing":-1,"cry":-1,"crying":-2,"cunt":-5,"curious":1,"curse":-1,"cut":-1,"cute":2,"cuts":-1,"cutting":-1,"cynic":-2,"cynical":-2,"cynicism":-2,"damage":-3,"damages":-3,"damn":-4,"damned":-4,"damnit":-4,"danger":-2,"daredevil":2,"daring":2,"darkest":-2,"darkness":-1,"dauntless":2,"dead":-3,"deadlock":-2,"deafening":-1,"dear":2,"dearly":3,"death":-2,"debonair":2,"debt":-2,"deceit":-3,"deceitful":-3,"deceive":-3,"deceived":-3,"deceives":-3,"deceiving":-3,"deception":-3,"decisive":1,"dedicated":2,"defeated":-2,"defect":-3,"defects":-3,"defender":2,"defenders":2,"defenseless":-2,"defer":-1,"deferring":-1,"defiant":-1,"deficit":-2,"degrade":-2,"degraded":-2,"degrades":-2,"dehumanize":-2,"dehumanized":-2,"dehumanizes":-2,"dehumanizing":-2,"deject":-2,"dejected":-2,"dejecting":-2,"dejects":-2,"delay":-1,"delayed":-1,"delight":3,"delighted":3,"delighting":3,"delights":3,"demand":-1,"demanded":-1,"demanding":-1,"demands":-1,"demonstration":-1,"demoralized":-2,"denied":-2,"denier":-2,"deniers":-2,"denies":-2,"denounce":-2,"denounces":-2,"deny":-2,"denying":-2,"depressed":-2,"depressing":-2,"derail":-2,"derailed":-2,"derails":-2,"deride":-2,"derided":-2,"derides":-2,"deriding":-2,"derision":-2,"desirable":2,"desire":1,"desired":2,"desirous":2,"despair":-3,"despairing":-3,"despairs":-3,"desperate":-3,"desperately":-3,"despondent":-3,"destroy":-3,"destroyed":-3,"destroying":-3,"destroys":-3,"destruction":-3,"destructive":-3,"detached":-1,"detain":-2,"detained":-2,"detention":-2,"determined":2,"devastate":-2,"devastated":-2,"devastating":-2,"devoted":3,"diamond":1,"dick":-4,"dickhead":-4,"die":-3,"died":-3,"difficult":-1,"diffident":-2,"dilemma":-1,"dipshit":-3,"dire":-3,"direful":-3,"dirt":-2,"dirtier":-2,"dirtiest":-2,"dirty":-2,"disabling":-1,"disadvantage":-2,"disadvantaged":-2,"disappear":-1,"disappeared":-1,"disappears":-1,"disappoint":-2,"disappointed":-2,"disappointing":-2,"disappointment":-2,"disappointments":-2,"disappoints":-2,"disaster":-2,"disasters":-2,"disastrous":-3,"disbelieve":-2,"discard":-1,"discarded":-1,"discarding":-1,"discards":-1,"disconsolate":-2,"disconsolation":-2,"discontented":-2,"discord":-2,"discounted":-1,"discouraged":-2,"discredited":-2,"disdain":-2,"disgrace":-2,"disgraced":-2,"disguise":-1,"disguised":-1,"disguises":-1,"disguising":-1,"disgust":-3,"disgusted":-3,"disgusting":-3,"disheartened":-2,"dishonest":-2,"disillusioned":-2,"disinclined":-2,"disjointed":-2,"dislike":-2,"dismal":-2,"dismayed":-2,"disorder":-2,"disorganized":-2,"disoriented":-2,"disparage":-2,"disparaged":-2,"disparages":-2,"disparaging":-2,"displeased":-2,"dispute":-2,"disputed":-2,"disputes":-2,"disputing":-2,"disqualified":-2,"disquiet":-2,"disregard":-2,"disregarded":-2,"disregarding":-2,"disregards":-2,"disrespect":-2,"disrespected":-2,"disruption":-2,"disruptions":-2,"disruptive":-2,"dissatisfied":-2,"distort":-2,"distorted":-2,"distorting":-2,"distorts":-2,"distract":-2,"distracted":-2,"distraction":-2,"distracts":-2,"distress":-2,"distressed":-2,"distresses":-2,"distressing":-2,"distrust":-3,"distrustful":-3,"disturb":-2,"disturbed":-2,"disturbing":-2,"disturbs":-2,"dithering":-2,"dizzy":-1,"dodging":-2,"dodgy":-2,"does not work":-3,"dolorous":-2,"dont like":-2,"doom":-2,"doomed":-2,"doubt":-1,"doubted":-1,"doubtful":-1,"doubting":-1,"doubts":-1,"douche":-3,"douchebag":-3,"downcast":-2,"downhearted":-2,"downside":-2,"drag":-1,"dragged":-1,"drags":-1,"drained":-2,"dread":-2,"dreaded":-2,"dreadful":-3,"dreading":-2,"dream":1,"dreams":1,"dreary":-2,"droopy":-2,"drop":-1,"drown":-2,"drowned":-2,"drowns":-2,"drunk":-2,"dubious":-2,"dud":-2,"dull":-2,"dumb":-3,"dumbass":-3,"dump":-1,"dumped":-2,"dumps":-1,"dupe":-2,"duped":-2,"dysfunction":-2,"eager":2,"earnest":2,"ease":2,"easy":1,"ecstatic":4,"eerie":-2,"eery":-2,"effective":2,"effectively":2,"elated":3,"elation":3,"elegant":2,"elegantly":2,"embarrass":-2,"embarrassed":-2,"embarrasses":-2,"embarrassing":-2,"embarrassment":-2,"embittered":-2,"embrace":1,"emergency":-2,"empathetic":2,"emptiness":-1,"empty":-1,"enchanted":2,"encourage":2,"encouraged":2,"encouragement":2,"encourages":2,"endorse":2,"endorsed":2,"endorsement":2,"endorses":2,"enemies":-2,"enemy":-2,"energetic":2,"engage":1,"engages":1,"engrossed":1,"enjoy":2,"enjoying":2,"enjoys":2,"enlighten":2,"enlightened":2,"enlightening":2,"enlightens":2,"ennui":-2,"enrage":-2,"enraged":-2,"enrages":-2,"enraging":-2,"enrapture":3,"enslave":-2,"enslaved":-2,"enslaves":-2,"ensure":1,"ensuring":1,"enterprising":1,"entertaining":2,"enthral":3,"enthusiastic":3,"entitled":1,"entrusted":2,"envies":-1,"envious":-2,"envy":-1,"envying":-1,"erroneous":-2,"error":-2,"errors":-2,"escape":-1,"escapes":-1,"escaping":-1,"esteemed":2,"ethical":2,"euphoria":3,"euphoric":4,"eviction":-1,"evil":-3,"exaggerate":-2,"exaggerated":-2,"exaggerates":-2,"exaggerating":-2,"exasperated":2,"excellence":3,"excellent":3,"excite":3,"excited":3,"excitement":3,"exciting":3,"exclude":-1,"excluded":-2,"exclusion":-1,"exclusive":2,"excuse":-1,"exempt":-1,"exhausted":-2,"exhilarated":3,"exhilarates":3,"exhilarating":3,"exonerate":2,"exonerated":2,"exonerates":2,"exonerating":2,"expand":1,"expands":1,"expel":-2,"expelled":-2,"expelling":-2,"expels":-2,"exploit":-2,"exploited":-2,"exploiting":-2,"exploits":-2,"exploration":1,"explorations":1,"expose":-1,"exposed":-1,"exposes":-1,"exposing":-1,"extend":1,"extends":1,"exuberant":4,"exultant":3,"exultantly":3,"fabulous":4,"fad":-2,"fag":-3,"faggot":-3,"faggots":-3,"fail":-2,"failed":-2,"failing":-2,"fails":-2,"failure":-2,"failures":-2,"fainthearted":-2,"fair":2,"faith":1,"faithful":3,"fake":-3,"fakes":-3,"faking":-3,"fallen":-2,"falling":-1,"falsified":-3,"falsify":-3,"fame":1,"fan":3,"fantastic":4,"farce":-1,"fascinate":3,"fascinated":3,"fascinates":3,"fascinating":3,"fascist":-2,"fascists":-2,"fatalities":-3,"fatality":-3,"fatigue":-2,"fatigued":-2,"fatigues":-2,"fatiguing":-2,"favor":2,"favored":2,"favorite":2,"favorited":2,"favorites":2,"favors":2,"fear":-2,"fearful":-2,"fearing":-2,"fearless":2,"fearsome":-2,"fed up":-3,"feeble":-2,"feeling":1,"felonies":-3,"felony":-3,"fervent":2,"fervid":2,"festive":2,"fiasco":-3,"fidgety":-2,"fight":-1,"fine":2,"fire":-2,"fired":-2,"firing":-2,"fit":1,"fitness":1,"flagship":2,"flees":-1,"flop":-2,"flops":-2,"flu":-2,"flustered":-2,"focused":2,"fond":2,"fondness":2,"fool":-2,"foolish":-2,"fools":-2,"forced":-1,"foreclosure":-2,"foreclosures":-2,"forget":-1,"forgetful":-2,"forgive":1,"forgiving":1,"forgotten":-1,"fortunate":2,"frantic":-1,"fraud":-4,"frauds":-4,"fraudster":-4,"fraudsters":-4,"fraudulence":-4,"fraudulent":-4,"free":1,"freedom":2,"frenzy":-3,"fresh":1,"friendly":2,"fright":-2,"frightened":-2,"frightening":-3,"frikin":-2,"frisky":2,"frowning":-1,"frustrate":-2,"frustrated":-2,"frustrates":-2,"frustrating":-2,"frustration":-2,"ftw":3,"fuck":-4,"fucked":-4,"fucker":-4,"fuckers":-4,"fuckface":-4,"fuckhead":-4,"fucking":-4,"fucktard":-4,"fud":-3,"fuked":-4,"fuking":-4,"fulfill":2,"fulfilled":2,"fulfills":2,"fuming":-2,"fun":4,"funeral":-1,"funerals":-1,"funky":2,"funnier":4,"funny":4,"furious":-3,"futile":2,"gag":-2,"gagged":-2,"gain":2,"gained":2,"gaining":2,"gains":2,"gallant":3,"gallantly":3,"gallantry":3,"generous":2,"genial":3,"ghost":-1,"giddy":-2,"gift":2,"glad":3,"glamorous":3,"glamourous":3,"glee":3,"gleeful":3,"gloom":-1,"gloomy":-2,"glorious":2,"glory":2,"glum":-2,"god":1,"goddamn":-3,"godsend":4,"good":3,"goodness":3,"grace":1,"gracious":3,"grand":3,"grant":1,"granted":1,"granting":1,"grants":1,"grateful":3,"gratification":2,"grave":-2,"gray":-1,"great":3,"greater":3,"greatest":3,"greed":-3,"greedy":-2,"green wash":-3,"green washing":-3,"greenwash":-3,"greenwasher":-3,"greenwashers":-3,"greenwashing":-3,"greet":1,"greeted":1,"greeting":1,"greetings":2,"greets":1,"grey":-1,"grief":-2,"grieved":-2,"gross":-2,"growing":1,"growth":2,"guarantee":1,"guilt":-3,"guilty":-3,"gullibility":-2,"gullible":-2,"gun":-1,"ha":2,"hacked":-1,"haha":3,"hahaha":3,"hahahah":3,"hail":2,"hailed":2,"hapless":-2,"haplessness":-2,"happiness":3,"happy":3,"hard":-1,"hardier":2,"hardship":-2,"hardy":2,"harm":-2,"harmed":-2,"harmful":-2,"harming":-2,"harms":-2,"harried":-2,"harsh":-2,"harsher":-2,"harshest":-2,"hate":-3,"hated":-3,"haters":-3,"hates":-3,"hating":-3,"haunt":-1,"haunted":-2,"haunting":1,"haunts":-1,"havoc":-2,"healthy":2,"heartbreaking":-3,"heartbroken":-3,"heartfelt":3,"heaven":2,"heavenly":4,"heavyhearted":-2,"hell":-4,"help":2,"helpful":2,"helping":2,"helpless":-2,"helps":2,"hero":2,"heroes":2,"heroic":3,"hesitant":-2,"hesitate":-2,"hid":-1,"hide":-1,"hides":-1,"hiding":-1,"highlight":2,"hilarious":2,"hindrance":-2,"hoax":-2,"homesick":-2,"honest":2,"honor":2,"honored":2,"honoring":2,"honour":2,"honoured":2,"honouring":2,"hooligan":-2,"hooliganism":-2,"hooligans":-2,"hope":2,"hopeful":2,"hopefully":2,"hopeless":-2,"hopelessness":-2,"hopes":2,"hoping":2,"horrendous":-3,"horrible":-3,"horrific":-3,"horrified":-3,"hostile":-2,"huckster":-2,"hug":2,"huge":1,"hugs":2,"humerous":3,"humiliated":-3,"humiliation":-3,"humor":2,"humorous":2,"humour":2,"humourous":2,"hunger":-2,"hurrah":5,"hurt":-2,"hurting":-2,"hurts":-2,"hypocritical":-2,"hysteria":-3,"hysterical":-3,"hysterics":-3,"idiot":-3,"idiotic":-3,"ignorance":-2,"ignorant":-2,"ignore":-1,"ignored":-2,"ignores":-1,"ill":-2,"illegal":-3,"illiteracy":-2,"illness":-2,"illnesses":-2,"imbecile":-3,"immobilized":-1,"immortal":2,"immune":1,"impatient":-2,"imperfect":-2,"importance":2,"important":2,"impose":-1,"imposed":-1,"imposes":-1,"imposing":-1,"impotent":-2,"impress":3,"impressed":3,"impresses":3,"impressive":3,"imprisoned":-2,"improve":2,"improved":2,"improvement":2,"improves":2,"improving":2,"inability":-2,"inaction":-2,"inadequate":-2,"incapable":-2,"incapacitated":-2,"incensed":-2,"incompetence":-2,"incompetent":-2,"inconsiderate":-2,"inconvenience":-2,"inconvenient":-2,"increase":1,"increased":1,"indecisive":-2,"indestructible":2,"indifference":-2,"indifferent":-2,"indignant":-2,"indignation":-2,"indoctrinate":-2,"indoctrinated":-2,"indoctrinates":-2,"indoctrinating":-2,"ineffective":-2,"ineffectively":-2,"infatuated":2,"infatuation":2,"infected":-2,"inferior":-2,"inflamed":-2,"influential":2,"infringement":-2,"infuriate":-2,"infuriated":-2,"infuriates":-2,"infuriating":-2,"inhibit":-1,"injured":-2,"injury":-2,"injustice":-2,"innovate":1,"innovates":1,"innovation":1,"innovative":2,"inquisition":-2,"inquisitive":2,"insane":-2,"insanity":-2,"insecure":-2,"insensitive":-2,"insensitivity":-2,"insignificant":-2,"insipid":-2,"inspiration":2,"inspirational":2,"inspire":2,"inspired":2,"inspires":2,"inspiring":3,"insult":-2,"insulted":-2,"insulting":-2,"insults":-2,"intact":2,"integrity":2,"intelligent":2,"intense":1,"interest":1,"interested":2,"interesting":2,"interests":1,"interrogated":-2,"interrupt":-2,"interrupted":-2,"interrupting":-2,"interruption":-2,"interrupts":-2,"intimidate":-2,"intimidated":-2,"intimidates":-2,"intimidating":-2,"intimidation":-2,"intricate":2,"intrigues":1,"invincible":2,"invite":1,"inviting":1,"invulnerable":2,"irate":-3,"ironic":-1,"irony":-1,"irrational":-1,"irresistible":2,"irresolute":-2,"irresponsible":2,"irreversible":-1,"irritate":-3,"irritated":-3,"irritating":-3,"isolated":-1,"itchy":-2,"jackass":-4,"jackasses":-4,"jailed":-2,"jaunty":2,"jealous":-2,"jeopardy":-2,"jerk":-3,"jesus":1,"jewel":1,"jewels":1,"jocular":2,"join":1,"joke":2,"jokes":2,"jolly":2,"jovial":2,"joy":3,"joyful":3,"joyfully":3,"joyless":-2,"joyous":3,"jubilant":3,"jumpy":-1,"justice":2,"justifiably":2,"justified":2,"keen":1,"kill":-3,"killed":-3,"killing":-3,"kills":-3,"kind":2,"kinder":2,"kiss":2,"kudos":3,"lack":-2,"lackadaisical":-2,"lag":-1,"lagged":-2,"lagging":-2,"lags":-2,"lame":-2,"landmark":2,"laugh":1,"laughed":1,"laughing":1,"laughs":1,"laughting":1,"launched":1,"lawl":3,"lawsuit":-2,"lawsuits":-2,"lazy":-1,"leak":-1,"leaked":-1,"leave":-1,"legal":1,"legally":1,"lenient":1,"lethargic":-2,"lethargy":-2,"liar":-3,"liars":-3,"libelous":-2,"lied":-2,"lifesaver":4,"lighthearted":1,"like":2,"liked":2,"likes":2,"limitation":-1,"limited":-1,"limits":-1,"litigation":-1,"litigious":-2,"lively":2,"livid":-2,"lmao":4,"lmfao":4,"loathe":-3,"loathed":-3,"loathes":-3,"loathing":-3,"lobby":-2,"lobbying":-2,"lol":3,"lonely":-2,"lonesome":-2,"longing":-1,"loom":-1,"loomed":-1,"looming":-1,"looms":-1,"loose":-3,"looses":-3,"loser":-3,"losing":-3,"loss":-3,"lost":-3,"lovable":3,"love":3,"loved":3,"lovelies":3,"lovely":3,"loving":2,"lowest":-1,"loyal":3,"loyalty":3,"luck":3,"luckily":3,"lucky":3,"lugubrious":-2,"lunatic":-3,"lunatics":-3,"lurk":-1,"lurking":-1,"lurks":-1,"mad":-3,"maddening":-3,"made-up":-1,"madly":-3,"madness":-3,"mandatory":-1,"manipulated":-1,"manipulating":-1,"manipulation":-1,"marvel":3,"marvelous":3,"marvels":3,"masterpiece":4,"masterpieces":4,"matter":1,"matters":1,"mature":2,"meaningful":2,"meaningless":-2,"medal":3,"mediocrity":-3,"meditative":1,"melancholy":-2,"menace":-2,"menaced":-2,"mercy":2,"merry":3,"mess":-2,"messed":-2,"messing up":-2,"methodical":2,"mindless":-2,"miracle":4,"mirth":3,"mirthful":3,"mirthfully":3,"misbehave":-2,"misbehaved":-2,"misbehaves":-2,"misbehaving":-2,"mischief":-1,"mischiefs":-1,"miserable":-3,"misery":-2,"misgiving":-2,"misinformation":-2,"misinformed":-2,"misinterpreted":-2,"misleading":-3,"misread":-1,"misreporting":-2,"misrepresentation":-2,"miss":-2,"missed":-2,"missing":-2,"mistake":-2,"mistaken":-2,"mistakes":-2,"mistaking":-2,"misunderstand":-2,"misunderstanding":-2,"misunderstands":-2,"misunderstood":-2,"moan":-2,"moaned":-2,"moaning":-2,"moans":-2,"mock":-2,"mocked":-2,"mocking":-2,"mocks":-2,"mongering":-2,"monopolize":-2,"monopolized":-2,"monopolizes":-2,"monopolizing":-2,"moody":-1,"mope":-1,"moping":-1,"moron":-3,"motherfucker":-5,"motherfucking":-5,"motivate":1,"motivated":2,"motivating":2,"motivation":1,"mourn":-2,"mourned":-2,"mournful":-2,"mourning":-2,"mourns":-2,"mumpish":-2,"murder":-2,"murderer":-2,"murdering":-3,"murderous":-3,"murders":-2,"myth":-1,"n00b":-2,"naive":-2,"nasty":-3,"natural":1,"naïve":-2,"needy":-2,"negative":-2,"negativity":-2,"neglect":-2,"neglected":-2,"neglecting":-2,"neglects":-2,"nerves":-1,"nervous":-2,"nervously":-2,"nice":3,"nifty":2,"niggas":-5,"nigger":-5,"no":-1,"no fun":-3,"noble":2,"noisy":-1,"nonsense":-2,"noob":-2,"nosey":-2,"not good":-2,"not working":-3,"notorious":-2,"novel":2,"numb":-1,"nuts":-3,"obliterate":-2,"obliterated":-2,"obnoxious":-3,"obscene":-2,"obsessed":2,"obsolete":-2,"obstacle":-2,"obstacles":-2,"obstinate":-2,"odd":-2,"offend":-2,"offended":-2,"offender":-2,"offending":-2,"offends":-2,"offline":-1,"oks":2,"ominous":3,"once-in-a-lifetime":3,"opportunities":2,"opportunity":2,"oppressed":-2,"oppressive":-2,"optimism":2,"optimistic":2,"optionless":-2,"outcry":-2,"outmaneuvered":-2,"outrage":-3,"outraged":-3,"outreach":2,"outstanding":5,"overjoyed":4,"overload":-1,"overlooked":-1,"overreact":-2,"overreacted":-2,"overreaction":-2,"overreacts":-2,"oversell":-2,"overselling":-2,"oversells":-2,"oversimplification":-2,"oversimplified":-2,"oversimplifies":-2,"oversimplify":-2,"overstatement":-2,"overstatements":-2,"overweight":-1,"oxymoron":-1,"pain":-2,"pained":-2,"panic":-3,"panicked":-3,"panics":-3,"paradise":3,"paradox":-1,"pardon":2,"pardoned":2,"pardoning":2,"pardons":2,"parley":-1,"passionate":2,"passive":-1,"passively":-1,"pathetic":-2,"pay":-1,"peace":2,"peaceful":2,"peacefully":2,"penalty":-2,"pensive":-1,"perfect":3,"perfected":2,"perfectly":3,"perfects":2,"peril":-2,"perjury":-3,"perpetrator":-2,"perpetrators":-2,"perplexed":-2,"persecute":-2,"persecuted":-2,"persecutes":-2,"persecuting":-2,"perturbed":-2,"pesky":-2,"pessimism":-2,"pessimistic":-2,"petrified":-2,"phobic":-2,"picturesque":2,"pileup":-1,"pique":-2,"piqued":-2,"piss":-4,"pissed":-4,"pissing":-3,"piteous":-2,"pitied":-1,"pity":-2,"playful":2,"pleasant":3,"please":1,"pleased":3,"pleasure":3,"poised":-2,"poison":-2,"poisoned":-2,"poisons":-2,"pollute":-2,"polluted":-2,"polluter":-2,"polluters":-2,"pollutes":-2,"poor":-2,"poorer":-2,"poorest":-2,"popular":3,"positive":2,"positively":2,"possessive":-2,"postpone":-1,"postponed":-1,"postpones":-1,"postponing":-1,"poverty":-1,"powerful":2,"powerless":-2,"praise":3,"praised":3,"praises":3,"praising":3,"pray":1,"praying":1,"prays":1,"prblm":-2,"prblms":-2,"prepared":1,"pressure":-1,"pressured":-2,"pretend":-1,"pretending":-1,"pretends":-1,"pretty":1,"prevent":-1,"prevented":-1,"preventing":-1,"prevents":-1,"prick":-5,"prison":-2,"prisoner":-2,"prisoners":-2,"privileged":2,"proactive":2,"problem":-2,"problems":-2,"profiteer":-2,"progress":2,"prominent":2,"promise":1,"promised":1,"promises":1,"promote":1,"promoted":1,"promotes":1,"promoting":1,"propaganda":-2,"prosecute":-1,"prosecuted":-2,"prosecutes":-1,"prosecution":-1,"prospect":1,"prospects":1,"prosperous":3,"protect":1,"protected":1,"protects":1,"protest":-2,"protesters":-2,"protesting":-2,"protests":-2,"proud":2,"proudly":2,"provoke":-1,"provoked":-1,"provokes":-1,"provoking":-1,"pseudoscience":-3,"punish":-2,"punished":-2,"punishes":-2,"punitive":-2,"pushy":-1,"puzzled":-2,"quaking":-2,"questionable":-2,"questioned":-1,"questioning":-1,"racism":-3,"racist":-3,"racists":-3,"rage":-2,"rageful":-2,"rainy":-1,"rant":-3,"ranter":-3,"ranters":-3,"rants":-3,"rape":-4,"rapist":-4,"rapture":2,"raptured":2,"raptures":2,"rapturous":4,"rash":-2,"ratified":2,"reach":1,"reached":1,"reaches":1,"reaching":1,"reassure":1,"reassured":1,"reassures":1,"reassuring":2,"rebellion":-2,"recession":-2,"reckless":-2,"recommend":2,"recommended":2,"recommends":2,"redeemed":2,"refuse":-2,"refused":-2,"refusing":-2,"regret":-2,"regretful":-2,"regrets":-2,"regretted":-2,"regretting":-2,"reject":-1,"rejected":-1,"rejecting":-1,"rejects":-1,"rejoice":4,"rejoiced":4,"rejoices":4,"rejoicing":4,"relaxed":2,"relentless":-1,"reliant":2,"relieve":1,"relieved":2,"relieves":1,"relieving":2,"relishing":2,"remarkable":2,"remorse":-2,"repulse":-1,"repulsed":-2,"rescue":2,"rescued":2,"rescues":2,"resentful":-2,"resign":-1,"resigned":-1,"resigning":-1,"resigns":-1,"resolute":2,"resolve":2,"resolved":2,"resolves":2,"resolving":2,"respected":2,"responsible":2,"responsive":2,"restful":2,"restless":-2,"restore":1,"restored":1,"restores":1,"restoring":1,"restrict":-2,"restricted":-2,"restricting":-2,"restriction":-2,"restricts":-2,"retained":-1,"retard":-2,"retarded":-2,"retreat":-1,"revenge":-2,"revengeful":-2,"revered":2,"revive":2,"revives":2,"reward":2,"rewarded":2,"rewarding":2,"rewards":2,"rich":2,"ridiculous":-3,"rig":-1,"rigged":-1,"right direction":3,"rigorous":3,"rigorously":3,"riot":-2,"riots":-2,"risk":-2,"risks":-2,"rob":-2,"robber":-2,"robed":-2,"robing":-2,"robs":-2,"robust":2,"rofl":4,"roflcopter":4,"roflmao":4,"romance":2,"rotfl":4,"rotflmfao":4,"rotflol":4,"ruin":-2,"ruined":-2,"ruining":-2,"ruins":-2,"sabotage":-2,"sad":-2,"sadden":-2,"saddened":-2,"sadly":-2,"safe":1,"safely":1,"safety":1,"salient":1,"sappy":-1,"sarcastic":-2,"satisfied":2,"save":2,"saved":2,"scam":-2,"scams":-2,"scandal":-3,"scandalous":-3,"scandals":-3,"scapegoat":-2,"scapegoats":-2,"scare":-2,"scared":-2,"scary":-2,"sceptical":-2,"scold":-2,"scoop":3,"scorn":-2,"scornful":-2,"scream":-2,"screamed":-2,"screaming":-2,"screams":-2,"screwed":-2,"screwed up":-3,"scumbag":-4,"secure":2,"secured":2,"secures":2,"sedition":-2,"seditious":-2,"seduced":-1,"self-confident":2,"self-deluded":-2,"selfish":-3,"selfishness":-3,"sentence":-2,"sentenced":-2,"sentences":-2,"sentencing":-2,"serene":2,"severe":-2,"sexy":3,"shaky":-2,"shame":-2,"shamed":-2,"shameful":-2,"share":1,"shared":1,"shares":1,"shattered":-2,"shit":-4,"shithead":-4,"shitty":-3,"shock":-2,"shocked":-2,"shocking":-2,"shocks":-2,"shoot":-1,"short-sighted":-2,"short-sightedness":-2,"shortage":-2,"shortages":-2,"shrew":-4,"shy":-1,"sick":-2,"sigh":-2,"significance":1,"significant":1,"silencing":-1,"silly":-1,"sincere":2,"sincerely":2,"sincerest":2,"sincerity":2,"sinful":-3,"singleminded":-2,"skeptic":-2,"skeptical":-2,"skepticism":-2,"skeptics":-2,"slam":-2,"slash":-2,"slashed":-2,"slashes":-2,"slashing":-2,"slavery":-3,"sleeplessness":-2,"slick":2,"slicker":2,"slickest":2,"sluggish":-2,"slut":-5,"smart":1,"smarter":2,"smartest":2,"smear":-2,"smile":2,"smiled":2,"smiles":2,"smiling":2,"smog":-2,"sneaky":-1,"snub":-2,"snubbed":-2,"snubbing":-2,"snubs":-2,"sobering":1,"solemn":-1,"solid":2,"solidarity":2,"solution":1,"solutions":1,"solve":1,"solved":1,"solves":1,"solving":1,"somber":-2,"some kind":0,"son-of-a-bitch":-5,"soothe":3,"soothed":3,"soothing":3,"sophisticated":2,"sore":-1,"sorrow":-2,"sorrowful":-2,"sorry":-1,"spam":-2,"spammer":-3,"spammers":-3,"spamming":-2,"spark":1,"sparkle":3,"sparkles":3,"sparkling":3,"speculative":-2,"spirit":1,"spirited":2,"spiritless":-2,"spiteful":-2,"splendid":3,"sprightly":2,"squelched":-1,"stab":-2,"stabbed":-2,"stable":2,"stabs":-2,"stall":-2,"stalled":-2,"stalling":-2,"stamina":2,"stampede":-2,"startled":-2,"starve":-2,"starved":-2,"starves":-2,"starving":-2,"steadfast":2,"steal":-2,"steals":-2,"stereotype":-2,"stereotyped":-2,"stifled":-1,"stimulate":1,"stimulated":1,"stimulates":1,"stimulating":2,"stingy":-2,"stolen":-2,"stop":-1,"stopped":-1,"stopping":-1,"stops":-1,"stout":2,"straight":1,"strange":-1,"strangely":-1,"strangled":-2,"strength":2,"strengthen":2,"strengthened":2,"strengthening":2,"strengthens":2,"stressed":-2,"stressor":-2,"stressors":-2,"stricken":-2,"strike":-1,"strikers":-2,"strikes":-1,"strong":2,"stronger":2,"strongest":2,"struck":-1,"struggle":-2,"struggled":-2,"struggles":-2,"struggling":-2,"stubborn":-2,"stuck":-2,"stunned":-2,"stunning":4,"stupid":-2,"stupidly":-2,"suave":2,"substantial":1,"substantially":1,"subversive":-2,"success":2,"successful":3,"suck":-3,"sucks":-3,"suffer":-2,"suffering":-2,"suffers":-2,"suicidal":-2,"suicide":-2,"suing":-2,"sulking":-2,"sulky":-2,"sullen":-2,"sunshine":2,"super":3,"superb":5,"superior":2,"support":2,"supported":2,"supporter":1,"supporters":1,"supporting":1,"supportive":2,"supports":2,"survived":2,"surviving":2,"survivor":2,"suspect":-1,"suspected":-1,"suspecting":-1,"suspects":-1,"suspend":-1,"suspended":-1,"suspicious":-2,"swear":-2,"swearing":-2,"swears":-2,"sweet":2,"swift":2,"swiftly":2,"swindle":-3,"swindles":-3,"swindling":-3,"sympathetic":2,"sympathy":2,"tard":-2,"tears":-2,"tender":2,"tense":-2,"tension":-1,"terrible":-3,"terribly":-3,"terrific":4,"terrified":-3,"terror":-3,"terrorize":-3,"terrorized":-3,"terrorizes":-3,"thank":2,"thankful":2,"thanks":2,"thorny":-2,"thoughtful":2,"thoughtless":-2,"threat":-2,"threaten":-2,"threatened":-2,"threatening":-2,"threatens":-2,"threats":-2,"thrilled":5,"thwart":-2,"thwarted":-2,"thwarting":-2,"thwarts":-2,"timid":-2,"timorous":-2,"tired":-2,"tits":-2,"tolerant":2,"toothless":-2,"top":2,"tops":2,"torn":-2,"torture":-4,"tortured":-4,"tortures":-4,"torturing":-4,"totalitarian":-2,"totalitarianism":-2,"tout":-2,"touted":-2,"touting":-2,"touts":-2,"tragedy":-2,"tragic":-2,"tranquil":2,"trap":-1,"trapped":-2,"trauma":-3,"traumatic":-3,"travesty":-2,"treason":-3,"treasonous":-3,"treasure":2,"treasures":2,"trembling":-2,"tremulous":-2,"tricked":-2,"trickery":-2,"triumph":4,"triumphant":4,"trouble":-2,"troubled":-2,"troubles":-2,"true":2,"trust":1,"trusted":2,"tumor":-2,"twat":-5,"ugly":-3,"unacceptable":-2,"unappreciated":-2,"unapproved":-2,"unaware":-2,"unbelievable":-1,"unbelieving":-1,"unbiased":2,"uncertain":-1,"unclear":-1,"uncomfortable":-2,"unconcerned":-2,"unconfirmed":-1,"unconvinced":-1,"uncredited":-1,"undecided":-1,"underestimate":-1,"underestimated":-1,"underestimates":-1,"underestimating":-1,"undermine":-2,"undermined":-2,"undermines":-2,"undermining":-2,"undeserving":-2,"undesirable":-2,"uneasy":-2,"unemployment":-2,"unequal":-1,"unequaled":2,"unethical":-2,"unfair":-2,"unfocused":-2,"unfulfilled":-2,"unhappy":-2,"unhealthy":-2,"unified":1,"unimpressed":-2,"unintelligent":-2,"united":1,"unjust":-2,"unlovable":-2,"unloved":-2,"unmatched":1,"unmotivated":-2,"unprofessional":-2,"unresearched":-2,"unsatisfied":-2,"unsecured":-2,"unsettled":-1,"unsophisticated":-2,"unstable":-2,"unstoppable":2,"unsupported":-2,"unsure":-1,"untarnished":2,"unwanted":-2,"unworthy":-2,"upset":-2,"upsets":-2,"upsetting":-2,"uptight":-2,"urgent":-1,"useful":2,"usefulness":2,"useless":-2,"uselessness":-2,"vague":-2,"validate":1,"validated":1,"validates":1,"validating":1,"verdict":-1,"verdicts":-1,"vested":1,"vexation":-2,"vexing":-2,"vibrant":3,"vicious":-2,"victim":-3,"victimize":-3,"victimized":-3,"victimizes":-3,"victimizing":-3,"victims":-3,"vigilant":3,"vile":-3,"vindicate":2,"vindicated":2,"vindicates":2,"vindicating":2,"violate":-2,"violated":-2,"violates":-2,"violating":-2,"violence":-3,"violent":-3,"virtuous":2,"virulent":-2,"vision":1,"visionary":3,"visioning":1,"visions":1,"vitality":3,"vitamin":1,"vitriolic":-3,"vivacious":3,"vociferous":-1,"vulnerability":-2,"vulnerable":-2,"walkout":-2,"walkouts":-2,"wanker":-3,"want":1,"war":-2,"warfare":-2,"warm":1,"warmth":2,"warn":-2,"warned":-2,"warning":-3,"warnings":-3,"warns":-2,"waste":-1,"wasted":-2,"wasting":-2,"wavering":-1,"weak":-2,"weakness":-2,"wealth":3,"wealthy":2,"weary":-2,"weep":-2,"weeping":-2,"weird":-2,"welcome":2,"welcomed":2,"welcomes":2,"whimsical":1,"whitewash":-3,"whore":-4,"wicked":-2,"widowed":-1,"willingness":2,"win":4,"winner":4,"winning":4,"wins":4,"winwin":3,"wish":1,"wishes":1,"wishing":1,"withdrawal":-3,"woebegone":-2,"woeful":-3,"won":3,"wonderful":4,"woo":3,"woohoo":3,"wooo":4,"woow":4,"worn":-1,"worried":-3,"worry":-3,"worrying":-3,"worse":-3,"worsen":-3,"worsened":-3,"worsening":-3,"worsens":-3,"worshiped":3,"worst":-3,"worth":2,"worthless":-2,"worthy":2,"wow":4,"wowow":4,"wowww":4,"wrathful":-3,"wreck":-2,"wrong":-2,"wronged":-2,"wtf":-4,"yeah":1,"yearning":1,"yeees":2,"yes":1,"youthful":2,"yucky":-2,"yummy":3,"zealot":-2,"zealots":-2,"zealous":2} 2 | -------------------------------------------------------------------------------- /AFINN-README.txt: -------------------------------------------------------------------------------- 1 | AFINN is a list of English words rated for valence with an integer 2 | between minus five (negative) and plus five (positive). The words have 3 | been manually labeled by Finn Årup Nielsen in 2009-2011. The file 4 | is tab-separated. There are two versions: 5 | 6 | AFINN-111: Newest version with 2477 words and phrases. 7 | 8 | AFINN-96: 1468 unique words and phrases on 1480 lines. Note that there 9 | are 1480 lines, as some words are listed twice. The word list in not 10 | entirely in alphabetic ordering. 11 | 12 | An evaluation of the word list is available in: 13 | 14 | Finn Årup Nielsen, "A new ANEW: Evaluation of a word list for 15 | sentiment analysis in microblogs", http://arxiv.org/abs/1103.2903 16 | 17 | The list was used in: 18 | 19 | Lars Kai Hansen, Adam Arvidsson, Finn Årup Nielsen, Elanor Colleoni, 20 | Michael Etter, "Good Friends, Bad News - Affect and Virality in 21 | Twitter", The 2011 International Workshop on Social Computing, 22 | Network, and Services (SocialComNet 2011). 23 | 24 | 25 | This database of words is copyright protected and distributed under 26 | "Open Database License (ODbL) v1.0" 27 | http://www.opendatacommons.org/licenses/odbl/1.0/ or a similar 28 | copyleft license. 29 | 30 | See comments on the word list here: 31 | http://fnielsen.posterous.com/old-anew-a-sentiment-about-sentiment-analysis 32 | 33 | 34 | In Python the file may be read into a dictionary with: 35 | 36 | >>> afinn = dict(map(lambda (k,v): (k,int(v)), 37 | [ line.split('\t') for line in open("AFINN-111.txt") ])) 38 | >>> afinn["Good".lower()] 39 | 3 40 | >>> sum(map(lambda word: afinn.get(word, 0), "Rainy day but still in a good mood".lower().split())) 41 | 2 42 | 43 | 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![npm version](https://badge.fury.io/js/ml-sentiment.svg)](https://badge.fury.io/js/ml-sentiment) 2 | [![build status](http://img.shields.io/travis/syzer/sentiment-analyser.svg?style=flat)](http://travis-ci.org/syzer/sentiment-analyser) 3 | [![Dependency Status](https://david-dm.org/syzer/sentiment-analyser.svg)](https://david-dm.org/syzer/sentiment-analyser) 4 | [![devDependency Status](https://david-dm.org/syzer/sentiment-analyser/dev-status.svg)](https://david-dm.org/syzer/sentiment-analyser#info=devDependencies) 5 | [![Code Coverage](https://img.shields.io/codecov/c/github/syzer/sentiment-analyser/master.svg)](https://codecov.io/github/syzer/sentiment-analyser?branch=master) 6 | [![Downloads Today](https://img.shields.io/npm/dt/ml-sentiment.svg)](https://badge.fury.io/js/ml-sentiment) 7 | [![Downloads Month](https://img.shields.io/npm/dm/ml-sentiment.svg)](https://badge.fury.io/js/ml-sentiment) 8 | 9 | # Wat 10 | 11 | [![Greenkeeper badge](https://badges.greenkeeper.io/syzer/sentiment-analyser.svg)](https://greenkeeper.io/) 12 | 13 | Simple text sentiment analyser. 14 | 15 | 16 | # Install 17 | 18 | ```sh 19 | npm install --save ml-sentiment 20 | ``` 21 | 22 | ### Usage 23 | 24 | ```js 25 | const ml = require('ml-sentiment')(); 26 | ml.classify('Rainy day but still in a good mood'); 27 | //=> 2 ... (overall positive sentiment) 28 | ``` 29 | 30 | 31 | # How 32 | 33 | Returns a positive number for positive sentiment association 34 | and negative number for negative sentiment association. 35 | 36 | #### Basics 37 | 38 | ```js 39 | var longSentence = `Transform json to csv data. The difference to my other 40 | module json2csv is json2csv-stream uses streams for transforming the incoming 41 | data. The module is built with the new streaming API from Node.js v0.10.0 but 42 | maintains backwards compatibility to earlier Node.js versions. Listen for 43 | header and line events or pipe the data directly to a readable stream.` 44 | 45 | const ml = require('ml-sentiment')(); 46 | ml.classify(longSentence); 47 | //=> 0 ... (very boring encyclopedia like text) 48 | 49 | ml.classify('Rainy day but still in a good mood'); 50 | //=> 2 ... (overall positive sentiment) 51 | ``` 52 | 53 | #### Negations 54 | 55 | ```js 56 | const ml = require('ml-sentiment')(); 57 | ml.classify(`not awesome`); 58 | //=> -3 (negative) 59 | 60 | ml.classify(`awesome`); 61 | //=> 3 (positive) 62 | ``` 63 | 64 | #### German 65 | 66 | ```js 67 | const ml = require('ml-sentiment')({lang: 'de'}); 68 | ml.classify(`Es ist nicht so toll`); 69 | //=> (negative) 70 | ``` 71 | 72 | # Credits 73 | 74 | Original model and data: 75 | Finn Årup Nielsen, "A new ANEW: Evaluation of a word list for 76 | sentiment analysis in microblogs", http://arxiv.org/abs/1103.2903 77 | 78 | For german model: 79 | R. Remus, U. Quasthoff & G. Heyer: SentiWS - a Publicly Available German-language Resource for Sentiment Analysis. 80 | In: Proceedings of the 7th International Language Ressources and Evaluation (LREC'10), 2010 81 | -------------------------------------------------------------------------------- /SentiWS.txt: -------------------------------------------------------------------------------- 1 | SentiWS 2 | ~~~~~~~ 3 | 4 | SentimentWortschatz, or SentiWS for short, is a publicly available German-language resource for sentiment analysis, opinion mining etc. It lists positive and negative polarity bearing words weighted within the interval of [-1; 1] plus their part of speech tag, and if applicable, their inflections. The current version of SentiWS (v1.8b) contains 1,650 positive and 1,818 negative words, which sum up to 15,649 positive and 15,632 negative word forms incl. their inflections, respectively. It not only contains adjectives and adverbs explicitly expressing a sentiment, but also nouns and verbs implicitly containing one. 5 | 6 | 7 | License 8 | ~~~~~~~ 9 | 10 | SentiWS is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License (http://creativecommons.org/licenses/by-nc-sa/3.0/). 11 | 12 | 13 | Obtain a Copy 14 | ~~~~~~~~~~~~~ 15 | The latest version of SentiWS can be found at http://wortschatz.informatik.uni-leipzig.de/download/. 16 | 17 | 18 | Data Format 19 | ~~~~~~~~~~~ 20 | SentiWS is organised in two utf8-encoded text files structured the following way: 21 | 22 | | \t \t ,..., \n 23 | 24 | where \t denotes a tab, and \n denotes a new line. 25 | 26 | 27 | Citation 28 | ~~~~~~~~ 29 | 30 | If you use SentiWS in your work we kindly ask you to cite 31 | 32 | R. Remus, U. Quasthoff & G. Heyer: SentiWS - a Publicly Available German-language Resource for Sentiment Analysis. 33 | In: Proceedings of the 7th International Language Ressources and Evaluation (LREC'10), 2010 34 | 35 | or use the following BibTeX-code snippet: 36 | 37 | @INPROCEEDINGS{remquahey2010, 38 | title = {SentiWS -- a Publicly Available German-language Resource for Sentiment Analysis}, 39 | booktitle = {Proceedings of the 7th International Language Resources and Evaluation (LREC'10)}, 40 | author = {Remus, R. and Quasthoff, U. and Heyer, G.}, 41 | year = {2010} 42 | } 43 | 44 | 45 | Version History 46 | ~~~~~~~~~~~~~~~ 47 | 48 | SentiWS is "work in progress" and hence far from being fully-fledged and error-free. It will be continuously refined by adding missing words and word forms and removing ambiguous ones. 49 | 50 | v1.8b, 2010-05-19: First publicly available version as described in Remus et al. (2010). 51 | v1.8c, 2012-03-21: Second publicly available version in which some POS tags were corrected. 52 | 53 | 54 | Corrections 55 | ~~~~~~~~~~~ 56 | 57 | Unfortunately, there were some typos and errors in Table 2 of our LREC'10 paper. Here is a corrected version: 58 | 59 | Positive Negative 60 | Adjectives Baseforms 784 11,101 61 | Inflections 698 9,992 62 | Adverbs Baseforms 6 4 63 | Inflections 0 0 64 | Nouns Baseforms 548 686 65 | Inflections 649 979 66 | Verbs Baseforms 312 430 67 | Inflections 2,249 2,843 68 | All Baseforms 1,650 1,818 69 | Inflections 13,999 13,814 70 | 71 | Total 15,649 15,632 72 | 73 | Table 2: Overview of the dictionary's content 74 | 75 | 76 | 77 | SentiWS.txt was last updated on 2012-03-21. -------------------------------------------------------------------------------- /german.json: -------------------------------------------------------------------------------- 1 | {"abmachung":0.028,"abschluß":0.028,"abstimmung":0.028,"agilität":0.028,"aktivität":0.028,"aktualisierung":0.028,"aktualität":0.028,"akzeptanz":0.028,"andrang":0.028,"anerkennung":0.59,"angebot":0.491,"angemessenheit":0.028,"anhebung":0.028,"anheiterung":0.028,"ankurbelung":0.028,"annehmlichkeit":0.028,"annäherung":0.028,"anpassung":0.028,"anpassungsfähigkeit":0.028,"anreicherung":0.028,"anspruch":0.028,"anstand":0.028,"anstieg":0.028,"anständigkeit":0.028,"anteil":0.028,"anziehung":0.028,"applaus":0.601,"attraktivität":0.028,"aufbereitung":0.028,"aufbesserung":0.028,"auferstehung":0.028,"aufmerksamkeit":0.028,"aufmunterung":0.028,"aufrichtigkeit":0.028,"aufschwung":0.028,"aufstieg":0.028,"aufstockung":0.028,"auftrag":0.028,"auftrieb":0.028,"aufwertung":0.028,"aufwärtstrend":0.028,"augenweide":0.582,"ausbau":0.028,"ausbildung":0.028,"ausdauer":0.611,"ausgleich":0.028,"ausgleichszahlung":0.028,"auszeichnung":0.028,"authentizität":0.028,"autonomie":0.028,"bedeutung":0.028,"befreiung":0.028,"befriedigung":0.028,"beförderung":0.028,"begeisterung":2.208,"begnadigung":0.028,"begünstigung":0.028,"beifall":2.253,"beifallsruf":0.028,"beilegung":0.028,"beisteuerung":0.028,"beitritt":0.028,"bekräftigung":0.028,"belastbarkeit":0.028,"belebtheit":0.028,"beliebtheit":0.028,"belohnung":0.561,"benefiz":0.028,"bereicherung":0.028,"bereitschaft":0.028,"bereitstellung":0.028,"beruhigung":0.028,"bescheidenheit":0.588,"beschleunigung":0.028,"beschwichtigung":0.028,"besitz":0.028,"besserung":0.028,"bestätigung":0.028,"beteiligung":0.028,"bewunderer":0.028,"bewunderung":0.028,"bildung":0.028,"blüte":0.028,"bonität":0.028,"bonus":0.028,"boom":0.028,"brillanz":0.028,"brüderlichkeit":0.028,"bund":0.028,"bündnis":0.028,"champion":0.028,"charisma":0.028,"charme":0.028,"cleverness":0.028,"comeback":0.491,"dankbarkeit":0.028,"diskretion":0.028,"disziplin":0.422,"duft":1.483,"dynamik":0.028,"echtheit":0.028,"effizienz":0.028,"ehre":0.505,"ehrfurcht":0.028,"ehrlichkeit":0.028,"ehrwürdigkeit":0.028,"eifer":0.028,"eigenkapital":0.028,"eignung":0.028,"eindeutigkeit":0.028,"einfallsreichtum":0.028,"einhaltung":0.028,"einheit":0.028,"einheitlichkeit":0.028,"einkauf":0.028,"einnahme":0.028,"einsparung":0.028,"einweihung":0.028,"einzigartigkeit":0.028,"eleganz":0.028,"empathie":0.028,"empfehlung":0.028,"engagement":1.488,"entlastung":0.028,"entlohnung":0.028,"entschluß":0.555,"entschlüsselung":0.028,"entschädigung":0.028,"entspannung":0.604,"entwirrung":0.028,"erbe":0.028,"erfahrung":0.028,"erfolg":2.378,"erfolgserlebnis":0.61,"erfüllung":0.028,"ergiebigkeit":0.028,"ergänzung":0.028,"erhaltung":0.028,"erholung":0.597,"erhöhung":0.028,"erlaubnis":0.028,"erleichterung":0.028,"erleuchtung":0.028,"erlösung":0.028,"ermutigung":0.028,"erneuerung":0.028,"ernsthaftigkeit":0.028,"ersparnis":0.028,"ertrag":0.028,"erweiterung":0.028,"erzeugnis":0.028,"experte":0.028,"expertise":0.028,"exzellenz":0.028,"fairness":0.028,"faszination":0.028,"favorit":0.028,"feier":0.572,"fertigkeit":0.028,"fest":1.619,"festakt":0.028,"festigkeit":0.028,"festlichkeit":0.028,"finanzierung":0.028,"fitness":0.587,"flair":1.529,"fleiß":2.148,"flexibilität":0.028,"fortschritt":0.028,"freiheit":0.028,"freispruch":0.028,"freude":4.486,"freund":0.08,"freundlichkeit":0.63,"freundschaft":1.421,"frieden":0.028,"fruchtbarkeit":0.028,"funktionsfähigkeit":0.028,"furchtlosigkeit":0.028,"fähigkeit":0.615,"förderung":0.572,"führung":0.028,"fülle":0.028,"gabe":0.515,"garantie":0.028,"gastfreundlichkeit":0.028,"gedenken":0.028,"geduld":0.544,"gefallen":2.311,"gehaltszulage":0.028,"gelassenheit":0.497,"geldgeber":0.028,"gemeinschaft":0.028,"genauigkeit":0.028,"genehmigung":0.028,"genesung":0.028,"genialität":0.028,"genie":0.481,"genuss":0.484,"genuß":0.504,"gerechtigkeit":0.028,"geräumigkeit":0.028,"geschenk":3.306,"geschick":0.028,"geschicklichkeit":0.028,"gesundheit":0.028,"gesundung":0.028,"gewinn":0.028,"gewinner":0.028,"gewährleistung":0.028,"glamour":0.028,"glanz":0.028,"glaube":0.028,"glaubwürdigkeit":0.028,"gleichstellung":0.028,"glück":1.692,"glückseligkeit":0.028,"glückwunsch":1.513,"gnade":0.028,"gratulation":2.953,"grenzenlosigkeit":0.028,"großzügigigkeit":0.028,"größe":0.028,"gründlichkeit":0.028,"gunst":0.028,"gönner":0.028,"gönnerschaft":0.028,"gültigkeit":0.028,"güte":0.028,"hammer":0.028,"harmonie":0.549,"harmonisierung":0.028,"hartnäckigkeit":0.028,"heiligtum":0.028,"heilung":0.028,"heirat":0.028,"heiterkeit":0.028,"helligkeit":0.028,"herrlichkeit":0.028,"highlight":0.028,"hilfe":0.028,"hilfsbereitschaft":0.028,"hingabe":0.028,"hochdruckgebiet":0.028,"hochruf":0.028,"hochwertigkeit":0.028,"hoffnung":1.406,"humanität":0.028,"humor":2.274,"hurra":0.028,"hurrageschrei":0.028,"höflichkeit":0.028,"höhepunkt":0.028,"individualität":0.028,"innovation":0.028,"inspiration":0.028,"integrität":0.028,"intellekt":0.028,"intelligenz":0.028,"interesse":0.028,"interessenvertretung":0.028,"investition":0.028,"jubel":0.45,"jubiläum":0.028,"kauf":0.028,"klarheit":0.028,"komfort":1.248,"kommunikation":0.028,"kompatibilität":0.028,"kompensation":0.028,"kompetenz":0.028,"kompliment":2.293,"kompromiss":0.028,"konjunkturaufschwung":0.028,"konsens":0.028,"konsistenz":0.028,"konsolidierung":0.028,"konstanz":0.028,"konsultation":0.028,"kontinuität":0.028,"kooperation":0.028,"koordinierung":0.028,"korrektheit":0.028,"korrektur":0.028,"kostbarkeit":0.028,"kraft":0.028,"kreativität":0.53,"kulanz":0.028,"kur":0.593,"langlebigkeit":0.028,"laune":0.749,"lebensfähigkeit":0.028,"legalität":0.028,"legitimität":0.028,"leichtigkeit":1.19,"leidenschaft":0.028,"leistung":0.028,"leistungsfähigkeit":0.028,"liberalismus":0.028,"liebe":0.68,"liebling":0.602,"linderung":0.028,"lob":5,"lohn":0.028,"loyalität":0.028,"luxus":0.028,"lösung":0.028,"macht":0.028,"magie":0.028,"majestät":0.028,"maximum":0.028,"meisterschaft":0.028,"meisterwerk":0.028,"menschenwürde":0.028,"menschlichkeit":0.028,"milde":0.028,"mitgefühl":0.028,"mobilität":0.028,"modernisierung":0.028,"modernität":0.028,"moral":0.028,"motivation":0.028,"mut":4.204,"möglichkeit":0.028,"nachhaltigkeit":0.028,"nutzen":0.028,"nähe":0.629,"oase":0.028,"optimalität":0.028,"optimismus":0.609,"optimist":0.577,"ordnungsmäßigkeit":0.028,"originalität":0.028,"pannenhilfe":0.028,"paradies":0.028,"partner":0.028,"partnerschaft":0.538,"perfektion":0.028,"perfektionismus":0.028,"perfektionist":0.028,"pflege":0.028,"phantasie":0.517,"plausibilität":0.028,"positivität":0.028,"potenz":0.028,"pracht":0.028,"praktikabilität":0.028,"premium":0.028,"prestige":0.028,"privileg":0.028,"produktivität":0.028,"profit":0.028,"progression":0.028,"prächtigkeit":0.028,"präferenz":0.028,"präzision":0.028,"pünktlichkeit":0.028,"qualifikation":0.028,"qualität":0.028,"qualitätsverbesserung":0.028,"rat":0.028,"recht":0.028,"rechtmäßigkeit":0.028,"rechtsgültigkeit":0.028,"rehabilitation":0.028,"reichtum":0.028,"reinheit":0.028,"reinigung":0.028,"relevanz":0.028,"renovierung":0.028,"rentabilität":0.028,"reparatur":-0.024,"respekt":0.028,"rettung":0.488,"robustheit":0.028,"romantik":0.475,"ruhe":3.462,"ruhm":0.028,"rückendeckung":0.028,"rückgrat":0.028,"rücksicht":0.028,"rückversicherung":0.028,"sauberkeit":0.521,"schatz":0.756,"schenkung":0.028,"schirmherr":0.028,"schirmherrschaft":0.028,"schlauheit":0.028,"schmuck":0.028,"schnelligkeit":0.028,"schnäppchen":0.028,"schuldlosigkeit":0.028,"schutz":0.028,"schutzmaßnahmen":0.028,"schwung":1.642,"schönheit":2.267,"selbstständigkeit":0.028,"sensation":0.028,"seriösität":0.028,"sicherheit":0.028,"siegeszug":0.028,"sinn":0.028,"solidarität":0.028,"sorgfältigkeit":0.028,"sorglosigkeit":0.028,"sparsamkeit":0.028,"spass":1.676,"spaß":1.948,"spende":0.028,"spezialität":0.028,"sprung":0.028,"stabilität":0.028,"standhaftigkeit":0.028,"stattlichkeit":0.028,"steigerung":0.028,"steigflug":0.028,"stifter":0.028,"stiftung":0.028,"stil":2.345,"stimulation":0.028,"stolz":0.55,"stärke":0.028,"stütze":0.028,"subvention":0.028,"suchtfaktor":0.028,"superlativ":0.028,"symbiose":0.028,"sympathie":0.028,"talent":2.313,"toleranz":0.028,"tradition":0.028,"treue":1.393,"triumph":0.028,"trophäe":0.028,"trost":0.487,"umbruch":0.028,"unabhängigkeit":0.028,"unbesiegbarkeit":0.028,"unerschrockenheit":0.028,"unfehlbarkeit":0.028,"unparteilichkeit":0.028,"unschuld":0.028,"unsterblichkeit":0.028,"unterstützung":0.028,"unverwundbarkeit":0.028,"unverzichtbarkeit":0.028,"unwiderstehlichkeit":0.028,"upgrade":0.028,"verantwortung":0.028,"verband":0.028,"verbesserung":0.028,"verbund":0.028,"verbundenheit":0.028,"verbündete":0.028,"verdienst":0.028,"veredelung":0.028,"verehrung":0.028,"vereinbarung":0.028,"vereinfachung":0.028,"vereinigung":0.028,"vererbung":0.028,"verfeinerung":0.028,"vergebung":0.028,"vergrößerung":0.028,"vergötterung":0.028,"verhandelung":0.028,"verlobung":0.028,"verlöbnis":0.028,"vermittlung":0.028,"vernunft":0.028,"verschönerung":0.028,"abbau":-0.29,"abbruch":-0.024,"abdankung":-0.024,"abdämpfung":-0.024,"abfall":-0.024,"abfuhr":-1.683,"abgrund":-1.732,"abhängigkeit":-1.827,"ablehnung":-2.559,"ablenkung":-0.217,"abnahme":-0.024,"abneigung":-0.024,"abnutzung":-0.024,"abriss":-0.024,"abrutsch":-0.024,"abschaffung":-0.29,"abschreckung":-0.024,"abschreibung":-1.673,"abschuß":-0.024,"abschwächung":-0.968,"absenkung":-1.717,"abspaltung":-0.024,"absperrung":-0.024,"abstieg":-1.607,"abstoß":-0.024,"abstrich":-1.601,"abstumpfung":-0.024,"absturz":-2.369,"absurdität":-0.024,"abweichung":-1.731,"abweisung":-0.024,"abwertung":-1.641,"abwärtstrend":-0.97,"abzocke":-0.024,"achtlosigkeit":-0.024,"affäre":-0.897,"aggression":-2.445,"aggressivität":-0.979,"aggressor":-1.578,"agitation":-0.024,"alarm":-0.024,"alptraum":-0.024,"amateur":-0.024,"ambivalenz":-1.633,"androhung":-0.024,"anfälligkeit":-0.024,"angreifer":-0.024,"angriff":-1.06,"angst":-2.57,"anklage":-1.734,"anmaßung":-0.024,"annullierung":-0.024,"anomalie":-0.024,"anspannung":-0.024,"anstrengung":-0.024,"antipathie":-0.024,"arbeitslose":-1.774,"arbeitslosigkeit":-1.827,"armut":-1.019,"arroganz":-1.645,"arschloch":-0.95,"attacke":-2.35,"aufhebung":-0.024,"auflösung":-0.024,"aufregung":-0.193,"aufruhr":-0.024,"aufschrei":-0.024,"aufstand":-0.024,"ausbeute":-0.947,"ausbeuter":-0.024,"ausbeutung":-0.024,"ausbruch":-0.024,"auseinandersetzung":-0.301,"ausfall":-1.082,"ausgrenzung":-3.13,"auslöschung":-0.024,"ausrottung":-0.024,"ausschließung":-0.024,"aussetzung":-0.024,"banalität":-0.024,"bankrott":-0.024,"barriere":-0.024,"bedeutungslosigkeit":-0.024,"bedrohung":-0.024,"bedrängung":-0.024,"bedrückung":-0.217,"bedürftige":-0.024,"beeinträchtigung":-1.736,"befall":-0.024,"befangenheit":-0.024,"befürchtung":-2.452,"begrenzung":-0.024,"behinderung":-1.789,"belastung":-1.855,"beleidigung":-1.716,"belästigung":-0.024,"beschneidung":-1.656,"beschränkung":-1.759,"beschuldigung":-1.605,"beschwerde":-0.024,"beschwerlichkeit":-0.024,"beschädigung":-0.024,"beschäftigungslose":-0.024,"beschäftigungsloser":-0.024,"beschämung":-0.024,"beseitigung":-0.024,"besorgnis":-0.024,"bestechung":-0.024,"besteuerung":-0.024,"bestrafung":-0.024,"bestürzung":-0.024,"betrug":-2.457,"betrüger":-1.655,"beule":-0.024,"beunruhigung":-1.62,"bevormundung":-0.024,"bitterkeit":-0.024,"blindheit":-0.024,"blockade":-0.024,"blockierung":-0.024,"blödheit":-0.024,"bombardement":-0.024,"bombardierung":-0.024,"bombe":-0.024,"bosheit":-1.685,"brand":-0.024,"bruch":-1.732,"brutalität":-0.024,"bußgeld":-1.688,"bösartigkeit":-1.595,"bösewicht":-0.024,"bürde":-0.262,"chaos":-1.744,"crash":-0.943,"defekt":-0.024,"defizit":-1.735,"deformation":-0.024,"degradierung":-1.568,"dekadenz":-0.024,"demütigung":-0.024,"denkfehler":-0.024,"depression":-2.475,"desaster":-1.706,"desinteresse":-1.674,"dezimierung":-0.024,"dieb":-0.981,"diebstahl":-1.752,"diffamierung":-2.296,"diktator":-0.024,"dilemma":-1.702,"diskriminierung":-0.024,"dissens":-0.024,"dominierung":-0.024,"doppeldeutigkeit":-0.024,"doppelspiel":-0.024,"dreck":-0.024,"drift":-0.024,"drohung":-0.024,"drosselung":-1.589,"dummheit":-2.439,"dummkopf":-0.024,"dunkelheit":-1.774,"durcheinander":-0.024,"dussel":-1.547,"dämpfer":-0.024,"dürre":-0.024,"düsternis":-0.024,"egoist":-1.59,"ehebruch":-2.372,"einbrecher":-0.024,"einbruch":-1.749,"einbuße":-0.024,"einsamkeit":-1.695,"einschlag":-0.024,"einschränkung":-1.024,"einschüchterung":-0.024,"einsturz":-0.024,"ekel":-2.31,"elend":-1.006,"empörung":-0.024,"ende":-1.044,"energielosigkeit":-0.024,"entbindung":-0.024,"entfremdung":-0.024,"entführung":-0.024,"enthauptung":-0.024,"entlassung":-0.024,"entmutigung":-0.024,"enttäuschung":-1.689,"entziehung":-0.024,"epidemie":-0.024,"ermahnung":-0.024,"ermordung":-1.66,"ermüdung":-0.024,"erniedrigung":-1.63,"ernüchterung":-0.024,"erosion":-0.333,"erpressung":-0.024,"erschöpfung":-0.297,"erschütterung":-0.024,"explosion":-0.024,"fahrlässigkeit":-0.024,"farce":-1.674,"faschist":-0.024,"faulheit":-3.055,"fehde":-0.024,"fehlanzeige":-0.024,"fehler":-3.376,"fehlermeldung":-2.382,"fehlkauf":-0.024,"fehlkonstruktion":-0.024,"fehlleistung":-0.024,"fehltritt":-0.024,"fehlverhalten":-1.731,"feind":-4.027,"feuer":-0.222,"fiasko":-0.024,"finanzkrise":-1.641,"finte":-0.024,"flaute":-0.207,"fluch":-1.767,"flucht":-0.024,"flüchtiger":-0.024,"flüchtigkeit":-0.024,"flüchtling":-0.024,"frechheit":-2.333,"frust":-2.345,"frustration":-1.677,"furcht":-2.506,"fälschung":-1.688,"gammler":-0.024,"gangster":-1.688,"garnichts":-0.024,"gauner":-2.296,"gebrechen":-1.625,"gedränge":-0.285,"gefahr":-5,"gefecht":-1.686,"gefährdung":-0.024,"gegner":-1.72,"geisteskrankheit":-0.024,"geistlosigkeit":-0.024,"geiz":-0.024,"geizhals":-0.024,"geizkragen":-0.024,"geldstrafe":-1.65,"geschmacklosigkeit":-0.024,"geschäftsauflösung":-0.024,"gestank":-0.024,"gewalt":-2.681,"gewalttätige":-0.024,"gewalttätiger":-0.024,"gift":-1.752,"glanzlosigkeit":-0.024,"gleichgültigkeit":-1.715,"glücklosigkeit":-0.024,"gnadenlosigkeit":-0.024,"grausamkeit":-1.674,"groll":-3.01,"groteske":-0.024,"habgier":-0.266,"haft":-0.024,"handgemenge":-1.587,"handicap":-0.213,"hass":-2.507,"heimsuchung":-0.024,"hektik":-0.024,"hemmung":-0.024,"herausforderung":-0.024,"heuchelei":-0.024,"heuchler":-1.625,"hilflosigkeit":-1.697,"hindernis":-0.024,"hinterhalt":-0.024,"hinterlist":-0.024,"hohn":-0.024,"horror":-0.255,"hunger":-1.766,"hungersnot":-2.369,"hungertod":-0.024,"hysterie":-1.693,"härte":-0.223,"hölle":-2.526,"idiot":-0.024,"illegalität":-0.024,"immobilität":-0.024,"ineffizienz":-0.024,"infektion":-1.03,"infiltration":-0.024,"inflation":-1.731,"inkompetenz":-0.024,"inkonsequenz":-0.227,"inkonsistenz":-1.548,"instabilität":-1.679,"intervention":-0.988,"invasion":-0.024,"isolation":-1.726,"jammer":-2.306,"jähzorn":-0.024,"kampf":-2.686,"kapitalverbrechen":-0.024,"kapitulation":-0.024,"katastrophe":-2.514,"keim":-0.024,"klage":-0.024,"klischee":-2.4,"kläger":-1.837,"knappheit":-0.024,"kollaps":-0.024,"kollision":-1.661,"komplikation":-0.024,"konflikt":-0.024,"konfrontation":-0.024,"konjunkturrückgang":-0.024,"konkurrenz":-0.231,"konkurrenzkampf":-0.247,"konkurs":-0.024,"kontroverse":-1.664,"kopfschmerzen":-0.997,"korruption":-1.72,"kostspieligkeit":-0.024,"krach":-0.024,"krankheit":-3.429,"krieg":-2.682,"kriminalität":-0.024,"krise":-1.81,"kritik":-2.654,"kritiker":-3.247,"kränkung":-0.024,"krüppel":-1.601,"kurseinbruch":-0.024,"kälte":-0.024,"kündigung":-0.024,"kürzung":-1.705,"langeweile":-0.189,"langweiler":-0.222,"last":-0.024,"launenhaftigkeit":-0.024,"lebensgefahr":-0.024,"leblosigkeit":-0.024,"leere":-0.024,"leichtsinn":-1.626,"leichtsinnsfehler":-0.185,"leid":-2.528,"leidende":-0.024,"liquidation":-0.024,"lähmung":-0.024,"löschung":-0.024,"lüge":-2.5,"lügner":-2.384,"makel":-0.906,"mangel":-1.835,"manipulation":-1.727,"massaker":-0.024,"maßlosigkeit":-0.024,"melancholie":-0.929,"melodrama":-0.024,"merkwürdigkeit":-0.024,"minderung":-0.024,"minderwertigkeit":-1.601,"missachtung":-0.024,"missbrauch":-0.024,"missgeschick":-0.236,"missglück":-0.024,"misstrauen":-2.389,"misstrauensantrag":-0.024,"missverständnis":-2.378,"mist":-0.866,"mittellosigkeit":-0.024,"mittelmäßigkeit":-0.024,"monotonie":-0.024,"mord":-1.797,"mutlosigkeit":-0.024,"müdigkeit":-0.998,"mühe":-0.024,"müll":-1.688,"nachlässigkeit":-0.024,"nachteil":-4.051,"naivität":-0.024,"narr":-1.675,"negativität":-1.578,"neid":-2.365,"nervosität":-0.916,"neustart":-0.252,"niedergang":-0.024,"niedergeschlagenheit":-0.024,"niederlage":-1.825,"not":-1.094,"notfall":-0.234,"notstand":-0.024,"nutzlosigkeit":-0.024,"nötigung":-0.024,"oberflächlichkeit":-1.65,"offensive":-0.024,"opposition":-1.815,"panik":-1.714,"panne":-0.95,"pech":-2.412,"pessimismus":-2.357,"pest":-1.728,"pflicht":-1.788,"pleite":-1.661,"preissturz":-0.024,"problem":-1.933,"propaganda":-2.446,"protest":-1.782,"provisorium":-0.024,"provokation":-0.024,"qual":-0.201,"qualitätsminderung":-1.548,"rache":-1.767,"ratlosigkeit":-0.024,"raub":-0.024,"rebellen":-0.024,"rebellion":-0.024,"rechtswidrigkeit":-0.249,"redundanz":-0.024,"reinfall":-0.024,"reklamation":-0.024,"revolte":-0.024,"revolution":-0.024,"rezession":-1.727,"risiko":-3.435,"rivale":-0.251,"rivalität":-0.024,"rost":-0.024,"ruin":-0.024,"rutsch":-0.024,"rätselraten":-0.024,"räuber":-1.754,"rückfall":-0.024,"rückgang":-1.048,"rückschritt":-0.024,"rücksendung":-1.732,"rücksichtslosigkeit":-0.024,"gut":3,"guten":2,"toll":2} 2 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ml-sentiment", 3 | "version": "2.0.7", 4 | "description": "Machine learner sentiment classifier, with ability to negate words, with english and german", 5 | "main": "src/index.js", 6 | "scripts": { 7 | "test": "tap test/*.js", 8 | "coverage": "./node_modules/.bin/istanbul cover node_modules/argg test/*.js && cat ./coverage/lcov.info | ./node_modules/.bin/codecov", 9 | "coverage-local": "./node_modules/.bin/istanbul cover node_modules/argg test/*.js" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/syzer/sentiment-analyser.git" 14 | }, 15 | "author": "", 16 | "license": "ISC", 17 | "bugs": { 18 | "url": "https://github.com/syzer/sentiment-analyser/issues" 19 | }, 20 | "keywords": [ 21 | "machine learning", 22 | "sentiment", 23 | "analyser", 24 | "nlp", 25 | "ml", 26 | "natural language processing" 27 | ], 28 | "homepage": "https://github.com/syzer/sentiment-analyser#readme", 29 | "devDependencies": { 30 | "argg": "0.0.2", 31 | "codecov.io": "^0.1.6", 32 | "istanbul": "^0.4.0", 33 | "tap": "^12.1.1" 34 | }, 35 | "dependencies": { 36 | "lodash-fp": "^0.10.4" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | module.exports = (opts) => { 2 | opts = opts || {} 3 | opts.words = opts.words || {} 4 | opts.tokenize = opts.tokenize || (el => el.replace(/\W/g, '')) 5 | opts.lang = opts.lang || 'en' 6 | 7 | var _ = require('lodash-fp') 8 | 9 | const classifyEn = (dict, negate) => (str) => 10 | str.toLowerCase() 11 | .split(' ') 12 | .map(opts.tokenize) 13 | .reduce((acc, word) => { 14 | var score = negate.test(acc.prev) ? -dict[word] : dict[word] 15 | return { 16 | sum: acc.sum + (score || 0), 17 | prev: word 18 | } 19 | }, {sum: 0, prev: ''}) 20 | .sum 21 | 22 | const classifyDe = (dict, negate) => (str) => 23 | str.toLowerCase() 24 | .split(' ') 25 | .map(opts.tokenize) 26 | .reduce((acc, word) => { 27 | var score = negate.test(acc.prev) ? -dict[word] : dict[word] 28 | return { 29 | sum: acc.sum + (score || 0), 30 | prev: word 31 | } 32 | }, {sum: 0, prev: ''}) 33 | .sum 34 | 35 | if ('en' === opts.lang) { 36 | return { 37 | classify: function() { 38 | var dict = _.merge(opts.words, require('./../AFINN-111.json')) 39 | var negate = new RegExp(/^(not|don't|dont|no|nope)$/) 40 | return classifyEn(dict, negate) 41 | }() 42 | } 43 | } else { 44 | return { 45 | classify: function() { 46 | var dict = _.merge(opts.words, require('./../german.json')) 47 | var negate = new RegExp(/^(nein|nicht|keine)$/) 48 | return classifyDe(dict, negate) 49 | }() 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /test/testEnglish.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const tap = require('tap').test 4 | const main = require('./../src/index.js') 5 | // js is horrible 6 | const lib = main({lang: 'en'}) 7 | const _ = require('lodash-fp') 8 | const longSentence = `Transform json to csv data. The difference to my other 9 | module json2csv is json2csv-stream uses streams for transforming the incoming 10 | data. The module is built with the new streaming API from Node.js v0.10.0 but 11 | maintains backwards compatibility to earlier Node.js versions. Listen for 12 | header and line events or pipe the data directly to a readable stream.` 13 | 14 | tap('a set of english tests', (t) => { 15 | t.test('on Good', (t) => { 16 | let test = lib.classify('Good') 17 | t.same(test, 3, 'is true') 18 | t.end() 19 | }) 20 | 21 | t.test('long string', (t) => { 22 | let test2 = lib.classify('Rainy day but still in a good mood') 23 | t.same(test2, 2, 'is true') 24 | t.end() 25 | }) 26 | 27 | t.test('long string', (t) => { 28 | let test3 = lib.classify(longSentence) 29 | t.ok(test3 > -5 && test3 < 5, 'in range') 30 | t.end() 31 | }) 32 | 33 | t.test('with dot.', (t) => { 34 | let test4 = lib.classify('Good.') 35 | let test5 = lib.classify('Good') 36 | t.same(test4, test5, 'dots dont bother us') 37 | t.end() 38 | }) 39 | 40 | t.test('extending library', (t) => { 41 | const lib2 = main({ 42 | words: { 43 | hyper: 5, 44 | hipster: -4 45 | } 46 | }) 47 | 48 | let test4 = lib2.classify('Good hyper') 49 | let test5 = lib2.classify('Good') 50 | let test6 = lib2.classify('Good hipster') 51 | 52 | t.ok(test4 > test5 > test6, 'with custom words') 53 | t.end() 54 | }) 55 | 56 | t.test('overwrite points', (t) => { 57 | let lib3 = main({ 58 | words: { 59 | good: 5 60 | } 61 | }) 62 | let test5 = lib3.classify('good') 63 | 64 | t.same(test5, 5, 'with good=5') 65 | t.end() 66 | }) 67 | 68 | //TODO better test 69 | t.test('custom tokenizer', (t) => { 70 | let lib4 = main({ 71 | tokenize: el => (el => el.replace(/\W /g, '')) 72 | }) 73 | let test = lib4.classify(`It's not great`) 74 | let test2 = lib4.classify('not great') 75 | 76 | t.same(test, test2, 'with custom tokenizer') 77 | t.end() 78 | }) 79 | 80 | t.test('performance test', (t) => { 81 | console.time('40000 requests/core in') 82 | 83 | _.times(() => lib.classify(longSentence), 40000) 84 | 85 | console.timeEnd('40000 requests/core in') 86 | t.end() 87 | }) 88 | 89 | t.test('negation of positive words', (t) => { 90 | let ml = main() 91 | let test = ml.classify(`not great`) 92 | let test2 = ml.classify(`great`) 93 | t.ok(test === -test2, 'negate next word') 94 | t.end() 95 | }) 96 | 97 | t.test('negation of negative words', (t) => { 98 | let ml = main() 99 | let test = ml.classify(`not awesome`) 100 | let test2 = ml.classify(`awesome`) 101 | t.ok(test === -test2, 'negate next word') 102 | t.end() 103 | }) 104 | 105 | // well done you have read all the tests! :) 106 | t.test('extending witch custom words', (t) => { 107 | let ml = main({ 108 | words: { 109 | beekeeping: 5, 110 | //':)': 5 //smiles do not work yet! 111 | } 112 | }) 113 | let test = ml.classify('Beekeeping is awesome :)') 114 | let test2 = ml.classify('awesome') 115 | t.same(test, test2 + 5, 'beekeeping is very awesome') 116 | t.end() 117 | }) 118 | 119 | t.end() 120 | }) 121 | -------------------------------------------------------------------------------- /test/testGerman.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const tap = require('tap').test 4 | const main = require('./../src/index.js') 5 | // js is horrible 6 | const lib = main({lang: 'de'}) 7 | const _ = require('lodash-fp') 8 | const longSentence = `Trans json zu CSV-Daten. Der Unterschied zu meinen anderen 9 | Modul json2csv ist json2csv-Stream verwendet Ströme für die Umwandlung der eingehenden 10 | Daten. Das Modul mit der neue Streaming API von Node.js v0.10.0 gebaut ist, aber 11 | unterhält die Abwärtskompatibilität zu früheren Versionen Node.js. Hören Sie 12 | Ereignisse oder Rohr Kopf- und die Daten direkt in einen lesbaren Stream.` 13 | 14 | tap('a set of german tests', (t) => { 15 | t.test('on Good', (t) => { 16 | let test = lib.classify('Gut') 17 | t.same(test, 3, 'good is good :)') 18 | t.end() 19 | }) 20 | 21 | t.test('long string', (t) => { 22 | let test2 = lib.classify('Regnerischen Tag , aber immer noch in einer guten Stimmung') 23 | t.same(test2, 2, 'is true') 24 | t.end() 25 | }) 26 | 27 | t.test('long string', (t) => { 28 | let test3 = lib.classify(longSentence) 29 | t.ok(test3 > -5 && test3 < 5, 'in range') 30 | t.end() 31 | }) 32 | 33 | t.test('with dot.', (t) => { 34 | let test4 = lib.classify('Gut.') 35 | let test5 = lib.classify('Gut') 36 | t.same(test4, test5, 'dots dont bother us') 37 | t.end() 38 | }) 39 | 40 | t.test('extending library', (t) => { 41 | const lib2 = main({ 42 | words: { 43 | hyper: 5, 44 | hipster: -4 45 | } 46 | }) 47 | 48 | let test4 = lib2.classify('Gut hyper') 49 | let test5 = lib2.classify('Gut') 50 | let test6 = lib2.classify('Gut hipster') 51 | 52 | t.ok(test4 > test5 > test6, 'with custom words') 53 | t.end() 54 | }) 55 | 56 | t.test('overwrite points', (t) => { 57 | let lib3 = main({ 58 | words: { 59 | gut: 5 60 | }, 61 | lang: 'de' 62 | }) 63 | let test5 = lib3.classify('Gut') 64 | 65 | t.same(test5, 5, 'with good=5') 66 | t.end() 67 | }) 68 | 69 | t.test('custom tokenizer', (t) => { 70 | let lib4 = main({ 71 | tokenize: el => (el => el.replace(/\W /g, '')), 72 | lang: 'de' 73 | }) 74 | let test = lib4.classify(`Es ist nicht so toll`) 75 | let test2 = lib4.classify('so toll') 76 | 77 | t.same(test, test2, 'with custom tokenizer') 78 | t.end() 79 | }) 80 | 81 | t.test('performance test', (t) => { 82 | console.time('40000 requests/core in') 83 | 84 | _.times(() => lib.classify(longSentence), 40000) 85 | 86 | console.timeEnd('40000 requests/core in') 87 | t.end() 88 | }) 89 | 90 | t.test('negation of positive words', (t) => { 91 | let test = lib.classify(`nicht toll`) 92 | let test2 = lib.classify(`toll`) 93 | t.ok(test === -test2, 'negate next word') 94 | t.ok(test !== 0, 'non zero value') 95 | t.end() 96 | }) 97 | 98 | t.test('negation of negative words', (t) => { 99 | let test = lib.classify(`keine panik`) 100 | let test2 = lib.classify(`panik`) 101 | t.ok(test === -test2, 'negate next word') 102 | t.ok(test !== 0, 'non zero value') 103 | t.end() 104 | }) 105 | 106 | // well done you have read all the tests! :) 107 | t.test('extending witch custom words', (t) => { 108 | let ml = main({ 109 | words: { 110 | bienenzucht: 5, 111 | ':)': 5 // smiles do not work yet! 112 | }, 113 | lang: 'de' 114 | }) 115 | let test = ml.classify('Bienenzucht bist toll :)') 116 | let test2 = ml.classify('toll') 117 | t.same(test, test2 + 5, 'Beekeeping is very awesome') 118 | t.end() 119 | }) 120 | 121 | t.end() 122 | }) 123 | --------------------------------------------------------------------------------