diff --git a/README.md b/README.md index 6544a04..4f43cd2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # 💬 GoSentiwordnet +[![Build Status](https://travis-ci.com/dinopuguh/gosentiwordnet.svg?branch=master)](https://travis-ci.com/dinopuguh/gosentiwordnet) [![Go Report Card](https://goreportcard.com/badge/github.com/dinopuguh/gosentiwordnet)](https://goreportcard.com/report/github.com/dinopuguh/gosentiwordnet) [![codecov](https://codecov.io/gh/dinopuguh/gosentiwordnet/branch/master/graph/badge.svg)](https://codecov.io/gh/dinopuguh/gosentiwordnet) + Sentiment analyzer using [sentiwordnet](https://github.com/aesuli/SentiWordNet) lexicon in Go. This library produce sentiment score for each word, including positive, negative, and objective score. ## ⚙ Installation diff --git a/example/main.go b/example/main.go index 794f9cf..98df231 100644 --- a/example/main.go +++ b/example/main.go @@ -17,9 +17,9 @@ func main() { sa := goswn.New() tokens := []Token{ - Token{Word: "love", PosTag: "v", Usage: "2"}, - Token{Word: "neat", PosTag: "a", Usage: "4"}, - Token{Word: "overacting", PosTag: "n", Usage: "1"}, + {Word: "love", PosTag: "v", Usage: "2"}, + {Word: "neat", PosTag: "a", Usage: "4"}, + {Word: "overacting", PosTag: "n", Usage: "1"}, } for _, token := range tokens { diff --git a/gosentiwordnet_test.go b/gosentiwordnet_test.go index c179144..a6a7288 100644 --- a/gosentiwordnet_test.go +++ b/gosentiwordnet_test.go @@ -16,10 +16,10 @@ type SentimentTestCase struct { func generateTestCases() []SentimentTestCase { return []SentimentTestCase{ - SentimentTestCase{Word: "love", PosTag: "v", Usage: "2", Scores: gosentiwordnet.Sentiment{Positive: 1, Negative: 0, Objective: 0}}, - SentimentTestCase{Word: "neat", PosTag: "a", Usage: "4", Scores: gosentiwordnet.Sentiment{Positive: 0.625, Negative: 0, Objective: 0.375}}, - SentimentTestCase{Word: "overacting", PosTag: "n", Usage: "1", Scores: gosentiwordnet.Sentiment{Positive: 0, Negative: 0.875, Objective: 0.125}}, - SentimentTestCase{Word: "finely", PosTag: "r", Usage: "2", Scores: gosentiwordnet.Sentiment{Positive: 0.625, Negative: 0, Objective: 0.375}}, + {Word: "love", PosTag: "v", Usage: "2", Scores: gosentiwordnet.Sentiment{Positive: 1, Negative: 0, Objective: 0}}, + {Word: "neat", PosTag: "a", Usage: "4", Scores: gosentiwordnet.Sentiment{Positive: 0.625, Negative: 0, Objective: 0.375}}, + {Word: "overacting", PosTag: "n", Usage: "1", Scores: gosentiwordnet.Sentiment{Positive: 0, Negative: 0.875, Objective: 0.125}}, + {Word: "finely", PosTag: "r", Usage: "2", Scores: gosentiwordnet.Sentiment{Positive: 0.625, Negative: 0, Objective: 0.375}}, } } diff --git a/helpers/substrings.go b/helpers/substrings.go index 128a0ba..1a56e1b 100644 --- a/helpers/substrings.go +++ b/helpers/substrings.go @@ -2,6 +2,7 @@ package helpers import "strings" +// CheckSubstrings checks the string containing substring or not func CheckSubstrings(str string, subs ...string) bool { isMatch := true