Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed Issue #2

  • Loading branch information...
commit b11de2b703b913190902b15abfe1dc2bce8388ca 1 parent ceefe3c
Scott Walters scowalt authored
2  app.rb
View
@@ -44,7 +44,7 @@ def initialize
mood[:description] = :bhargav
mood[:description] = :happy if info[3] > 0
mood[:description] = :sad if info[3] < 0
- pp mood[:description], "Description score: #{info[3]}; User description: #{status.user.description}"
+ pp mood[:description], "Desc. score: #{info[3].to_s.ljust(8)}User description: #{status.user.description}"
},
})
end
10 lib/twitter-sentiment/parser/face_recon.rb
View
@@ -34,14 +34,16 @@ def smile_info info = ""
#@return [float] average happiness
def profile_image_happiness img = nil
if img != nil
- if img.index("_normal") != nil #to feed the face API larger images
- len = img.length
- img = img[0..len - 12] + img[len - 4..len - 1] #remove "_normal"
- end
+ #formatting url
+ img = img + "?x=.png"
+
+ #executing search
arr = @client.detect_faces(img) #call whatever calls the FaceAPI
arr = smile_info(arr) #format the search results
return 0 if arr.length == 0
# expecting arr = [[boolean,int],[boolean,int].....]
+
+ #tabulating results
score = 0
arr.each do |n|
s = n[1]
4 lib/twitter-sentiment/parser/user_info.rb
View
@@ -18,11 +18,11 @@ def gather user
if user != nil
boringImages = default_imgs(user.profile_background_image_url, user.profile_image_url) #int
followPerTweet = user.followers_count.to_f / user.statuses_count.to_f #float, 0...
- profHappiness = @facerecon.profile_image_happiness(user.profile_image_url) #int, -100...100
+ profImgHappiness = @facerecon.profile_image_happiness(user.profile_image_url.gsub(/_normal/, '')) #int, -100...100
descriptionScore = @textmood.score(user.description) #int
#Spit out data in some format
- return [boringImages, followPerTweet, profHappiness, descriptionScore]
+ return [boringImages, followPerTweet, profImgHappiness, descriptionScore]
end
return [0,0,0,0] if user == nil
end
Please sign in to comment.
Something went wrong with that request. Please try again.