make the scoring rudimentary

This commit is contained in:
Asim Aslam
2021-06-02 11:48:23 +01:00
parent 358de467cd
commit 8272f0dffd

View File

@@ -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)
}