HumorChecker

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2015 License: MIT Imports: 3 Imported by: 0

README

HumorChecker - port of SentiMental into Go.

Build Status

Credits where credits are due: consider starring SentiMental repo on which this one was based.

Sentiment analysis tool based on the AFINN-111 wordlist.

Install

$ go get cirello.io/HumorChecker

Features

  • Positivity ranking
  • Negativity ranking
  • Analyze - combines Positivity and Negativity ranking into an aggregate sentiment score

Example

package main

import hc "cirello.io/HumorChecker"

func main(){
	hc.Analyze("Hey you worthless scumbag"); //Score: -6, Comparative:-1.5
	hc.Positivity("This is so cool"); //Score: 1, Comparative:.25
	hc.Negativity("Hey you worthless scumbag"); //Score: 6, Comparative:1.5
	hc.Analyze("I am happy"); //Score: 3, Comparative: 1
	hc.Analyze("I am so happy"); //Score: 6, Comparative: 1.5
	hc.Analyze("I am extremely happy"); //Score: 12, Comparative: 3
	hc.Analyze("I am really sad"); //Score: -4, Comparative: -1
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FullScore

type FullScore struct {
	// Score is the difference between positive and negative sentiment
	// scores.
	Score float64

	// Comparative is the difference between positive and negative sentiment
	// comparative scores.
	Comparative float64

	// Positive score object
	Positive Score

	// Negative score object
	Negative Score
}

func Analyze

func Analyze(phrase string) FullScore

Analyze calculates overall sentiment

type Score

type Score struct {
	// Score is the sum of the sentiment points of the analyzed text.
	// Negativity will render negative points only, and vice-versa.
	Score float64

	// Comparative establishes a ratio of sentiment per word
	Comparative float64

	// List of words for a given sentiment.
	Words []string
}

func Negativity

func Negativity(phrase string) Score

Negativity calculates the negative sentiment of a sentence

func Positivity

func Positivity(phrase string) Score

Positiviy calculates the positive sentiment of a sentence

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL