From 8272f0dffd908c8f20230a6b2b1b668707c6e401 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Wed, 2 Jun 2021 11:48:23 +0100 Subject: [PATCH] make the scoring rudimentary --- sentiment/model/model.go | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/sentiment/model/model.go b/sentiment/model/model.go index ec774b6..b433bbf 100644 --- a/sentiment/model/model.go +++ b/sentiment/model/model.go @@ -20,19 +20,5 @@ func init() { func Analyze(text string) float64 { an := model.SentimentAnalysis(text, sentiment.English) - - // no words, just return whats scored - if len(an.Words) == 0 { - return float64(an.Score) - } - - // take each word score then divide by num words - var total float64 - - for _, word := range an.Words { - total += float64(word.Score) - } - - // get the overall score - return total / float64(len(an.Words)) + return float64(an.Score) }