Skip to content

Instantly share code, notes, and snippets.

Created April 27, 2012 04:35
Show Gist options
  • Save anonymous/2505803 to your computer and use it in GitHub Desktop.
Save anonymous/2505803 to your computer and use it in GitHub Desktop.
article = "happy happy Sad Happy Lost"
positive = ['happy']
negative = ['sad', 'lost']
def aS(article, positive, negative)
pos = 0
neg = 0
pos << article.downcase.split.count(positive)
neg << article.downcase.split.count(negative)
result = ((pos-neg)/(pos+neg))*100
puts result
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment