Last active
August 29, 2015 14:10
-
-
Save lastlegion/d29bcd2850f336799696 to your computer and use it in GitHub Desktop.
sentimentscore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(text){ | |
var score = 0; | |
var words = text.split(" "); | |
for(var i in words){ | |
word = words[i]; | |
if(word in this.wordList){ | |
score+= this.wordList[word]; | |
} | |
} | |
return score/words.length; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment