Permalink
Browse files

Fixed emo dict, fixed feature specs in anticipation of better test co…

…verage, and modified face recon and twitter inputs.
  • Loading branch information...
2 parents 95bfc40 + d120361 commit e7337f5ef8661d291d65e1d2d663bd991d098742 Jake McGinty committed Mar 4, 2012
View
3 README.md
@@ -59,7 +59,6 @@ Research Leads
[Measuring User Influence in Twitter](http://an.kaist.ac.kr/~mycha/docs/icwsm2010_cha.pdf)
-
Projects/Papers
---------------
@@ -69,4 +68,4 @@ Projects/Papers
[We Feel Fine](http://wefeelfine.org/faq.html)
-
+Modeling Statistical Properties of Written Text (lookup!)
View
6 dict/AFINN-111-emo.txt
@@ -12,9 +12,9 @@
=( -3
=) 3
=d 3
-:-) 3
-:-( -3
-:'( -4
+:-) 3
+:-( -3
+:'( -4
abandon -2
abandoned -2
abandons -2
View
7 features/text_mood.feature
@@ -1,6 +1,6 @@
Feature: Text Mood Parsing
In order to make sure the dictionary bag-of-words with weightings is parsed without mistakes
- I am going to pass in a known legal file and request it be parsed and report back a score
+ I am going to pass known and unknown file inputs and request it be parsed and report back a score
Scenario: Initializing with a symbol
Given I start an instance initialized with ':afinn'
@@ -19,4 +19,7 @@ Feature: Text Mood Parsing
Scenario: Initializing with a legit filepath string
Given I start an instance initialized with 'dict/AFINN-111.txt'
When I ask the score of 'darthvaderinaspeedo'
- Then the score returned should be 'nil'
+ Then the score returned should be 'nil'
+
+Feature: Text Mood Dictionary Augmentation
+ In order for the dictionary
View
2 lib/twitter-sentiment/input/twitter.rb
@@ -25,7 +25,7 @@ def initialize options
#@client.track("@#{default[:user_name]}") do |status|
# puts "[#{status.user.screen_name}] #{status.text}"
#end
- @client.track("#ladygaga") do |status|
+ @client.track(default[:search_phrase]) do |status|
# raw debug tweet output
pp :debug, "#{Paint['['+status.user.screen_name+']', :yellow]} #{status.text}", :high
View
17 lib/twitter-sentiment/parser/face_recon.rb
@@ -27,14 +27,17 @@ def smile_info info = ""
arr
end
- # Finds the average happiness of people in profile picture,
- # weighted based on confience and number of faces
- #
- # @param [String] imgURL
- # @return [float] average happiness
+ #Finds the average happiness of people in profile picture,
+ #weighted based on confience and number of faces
+ #@param [String] imgURL
+ #@return [float] average happiness
def profile_image_happiness img = nil
- pp :info, "Getting profileImageHappiness for #{img}."
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
+ pp :info, "Getting profile_image_happiness for #{img}."
arr = @client.detect_faces(img) #call whatever calls the FaceAPI
arr = smile_info(arr) #format the search results
return 0 if arr.length == 0
@@ -50,4 +53,4 @@ def profile_image_happiness img = nil
end
end # FaceRecon
end # Parser
-end # TwitterSentiment
+end # TwitterSentiment
View
2 lib/twitter-sentiment/parser/text_mood.rb
@@ -17,10 +17,12 @@ class TextMood
def symbolize string
string.gsub(/\s+/, "_").downcase.to_sym
end
+ private :symbolize
def desymbolize sym
sym.to_s.gsub(/_/," ")
end
+ private :desymbolize
# Load a file to be used as our bag of words.
#
View
1 lib/twitter-sentiment/prefs/defaults.rb
@@ -30,6 +30,7 @@ def self.twitter
{
:user_id => 480959867,
:user_name => 'sigmusic_uiuc',
+ :search_phrase => "#YouProbablyShouldnt",
}
end
end

0 comments on commit e7337f5

Please sign in to comment.