Giter Site home page Giter Site logo

merelinguist / mindreader Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.62 MB

Super simple sentiment analysis with AFINN.

Home Page: https://npm.im/mindreader

License: MIT License

TypeScript 100.00%
tsdx typescript nlp sentiment sentiment-analysis sentiment-scores afinn

mindreader's Introduction

Super simple sentiment analysis with AFINN.

Usage

npm i styled-preflight
yarn add styled-preflight
import { mindreader } from 'mindreader';

const sentiment = mindreader('good, bad');

console.log(sentiment);

/*
{
  score: -3,
  comparative: -1,
  calculation: [{ ugly: -3 }, { bad: -3 }, { good: 3 }],
  tokens: ['good', 'bad', 'ugly'],
  words: ['ugly', 'bad', 'good],
  positive: ['good']
  negative: ['ugly', 'bad']
}
*/

Input & Ouput

Input

mindreader takes any string input, for example:

import { mindreader } from 'mindreader';

const sentiment = mindreader(
  'It was the best of times, it was the worst of times...'
);

...

Output

The full output looks like this:

Name Type Description
score number The overall sentiment score. Essentially just the sentiment ratings of each token, added up.
comparative number If you want to compare several strings, use this. It calculates the average score of all the tokens in your provided string.
calculation { [key: string]: number }[] How did we get here? This outputs the score which was assigned to each individual token in the string. If you want to do word-by-word sentiment analysis, passing in a big string to mindreader, and then reading from caluclation is the fastest way of doing it.
tokens string[] A list of the words in your string.
words string[] All the words which mindreader actually scanned. Some stopwords, like β€œthe”, or rarer words will not be included here.
positive number A list of the positive marked words (those scored above 0) .
negative number A list of the positive marked words (those scored below 0) .

Prior art

mindreader's People

Contributors

merelinguist avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.