Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed Issue #2

  • Loading branch information...
commit b11de2b703b913190902b15abfe1dc2bce8388ca 1 parent ceefe3c
Scott Walters scowalt authored
2  app.rb
@@ -44,7 +44,7 @@ def initialize
44 44 mood[:description] = :bhargav
45 45 mood[:description] = :happy if info[3] > 0
46 46 mood[:description] = :sad if info[3] < 0
47   - pp mood[:description], "Description score: #{info[3]}; User description: #{status.user.description}"
  47 + pp mood[:description], "Desc. score: #{info[3].to_s.ljust(8)}User description: #{status.user.description}"
48 48 },
49 49 })
50 50 end
10 lib/twitter-sentiment/parser/face_recon.rb
@@ -34,14 +34,16 @@ def smile_info info = ""
34 34 #@return [float] average happiness
35 35 def profile_image_happiness img = nil
36 36 if img != nil
37   - if img.index("_normal") != nil #to feed the face API larger images
38   - len = img.length
39   - img = img[0..len - 12] + img[len - 4..len - 1] #remove "_normal"
40   - end
  37 + #formatting url
  38 + img = img + "?x=.png"
  39 +
  40 + #executing search
41 41 arr = @client.detect_faces(img) #call whatever calls the FaceAPI
42 42 arr = smile_info(arr) #format the search results
43 43 return 0 if arr.length == 0
44 44 # expecting arr = [[boolean,int],[boolean,int].....]
  45 +
  46 + #tabulating results
45 47 score = 0
46 48 arr.each do |n|
47 49 s = n[1]
4 lib/twitter-sentiment/parser/user_info.rb
@@ -18,11 +18,11 @@ def gather user
18 18 if user != nil
19 19 boringImages = default_imgs(user.profile_background_image_url, user.profile_image_url) #int
20 20 followPerTweet = user.followers_count.to_f / user.statuses_count.to_f #float, 0...
21   - profHappiness = @facerecon.profile_image_happiness(user.profile_image_url) #int, -100...100
  21 + profImgHappiness = @facerecon.profile_image_happiness(user.profile_image_url.gsub(/_normal/, '')) #int, -100...100
22 22 descriptionScore = @textmood.score(user.description) #int
23 23
24 24 #Spit out data in some format
25   - return [boringImages, followPerTweet, profHappiness, descriptionScore]
  25 + return [boringImages, followPerTweet, profImgHappiness, descriptionScore]
26 26 end
27 27 return [0,0,0,0] if user == nil
28 28 end

0 comments on commit b11de2b

Please sign in to comment.
Something went wrong with that request. Please try again.