Step 5Choosing good search terms
Twitter allows you to search for recent tweets that contain particular words or phrases.
You can search for tweets that contain any of a list of phrases by using the "+OR+" conjunction.
For example, here is a search request that might find tweets that express Fear:
GET /search.json?q="i'm+so+scared"+OR+"i'm+really+scared"+OR+"i'm+terrified"+OR+"i'm+really+afraid"+OR+"so+scared+i"&rpp=30&result_type=recent
I spent a long time finding good search phrases.
The search phrases needed to produce tweets that:
- very often express the desired emotion.
- very rarely express the opposite emotion or no emotion.
Many search phrases that I thought would work, turned out to not work that well when I searched with them.
Smileys have been used with some success to extract whether the sentence is positive or negative, but I didn't find them useful for extracting anything more.
The trouble with smileys is that a smile can mean so many things ;D
It is often used, it seems, as a kind of qualifier for the whole sentence; since people have to compress their thoughts into 140 characters, the meaning can become ambiguous.
The smiley often then acts as a qualifier that:
- 'this is a friendly comment'
- 'don't take this the wrong way'
- 'i am saying hello/goodbye with a smile'
- 'this is almost a joke'
- 'I know I'm being cheeky'
- 'I don't really mean this'
"so scared" or "really scared" is better than just "scared" which returns bad results: for example, "not scared".
Phrases in the first person seemed to produce better results.
Some search phrases give tweets that suggest the author feels the emotion: for example, "i really hate...", often sounds like they really are full of hate or angry, whereas other phrases containing the word "hate" give tweets that do not seem to express much emotion, like "why do you hate..."
Hyperbole is your best friend, ever:
Using phrases with hyperbole produced good results. Tweets with "I'm terrified" or "I'm petrified" in them were generally more fearful sounding than "I'm scared"
Regardless, the approach is still naive, but statistically, from my tests, it does seem to work well.
While testing the code, I did at one point get the horribly ominous "Flashing White" that signifies the world is feeling intense fear, but since I was still testing it all, I did not hide under the table straight away, but instead, threw caution to the winds, and went on to Twitter to see what people were suddenly so fearful about.
The recent tweets containing the Fear search string (see top of page) were largely relating to a large thunderstorm that had just started somewhere near Florida.
If you're interested, here are some of those tweets:
So... it works! ...Well, it needs the numbers tweaking to ignore the world's "tantrums", the short-lived fits of emotional outburst, and be more concerned with larger changes that signify bigger news.
- "Ahhh Thunder I'm so scared of Thunder !!!!! Help some 1"
- "I'm so scared of lightning now. Like I just ran home praying "
- "On our way to Narcosses at @Disney world's Grand Floridian hotel and there's a tropical storm right now. I'm terrified! ..."
- "I'm in my bathroom til the rain stops. I'm terrified of lightning and thunder..."
- "I'm terrified of thunder storms *hides in corner*"
- "I'm terrified of Thunder :("
- "If only I was wit my becky during this thunderstorm cause I'm really scared cause of a bad experience"
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|

















































