Skip to content

momtr/sentiment-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

sentiment-analysis

sentiment analysis algorithm using the AFINN-111 dataset

Data

dataset can be found here: http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6010 (see data/license.txt)

Documentation

SentimentAnalysis(path)

let analyzer = new SentimentAnalysis('./data/AFINN-111.json')

Constructor function
path - string, the path to the json file containing the data (by default: ./lib/AFINN-111.json)

getScore(string)

analyzer.getScore('I am happy')

This function returns the sentiment score for a particular string
string - string, the input string, for instance a sentence

returns:
{
    words: ['word1', ...],
    score: int,
    cases: words.length
}

scoreFile(pathToFile)

analyzer.scoreFile('./path/to/file.txt')

This function returns the sentiment score of a file
pathToFile - string, path to the input file

returns:
{
    words: ['word1', ...],
    score: int,
    cases: words.length
}

Example

Examples can be found in folder examples.

About

πŸ™‚πŸ˜•πŸ˜£ sentiment analysis using the AFINN-111 dataset

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published