-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.py
20 lines (14 loc) · 4.78 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Copyright (c) 2008 Yahoo! Inc. All rights reserved.
# Licensed under the Yahoo! Search BOSS Terms of Use
# (http://info.yahoo.com/legal/us/yahoo/search/bosstos/bosstos-2317.html)
"""
This answers questions that start with who/what/where
It searches the question, extracts the capitalized n-grams from the abstracts and titles
Then does a group by, summing up the frequencies, and prints the top n-gram
This technique actually works sometimes ...
"""
from operator import itemgetter
thing = [{'rawTime': 1268656937.0, 'description': u'RT @saurabhsahni: RT @webmeme: Facebook To Open Office In Hyderabad, India http://bit.ly/cjQX1E ', 'pubDate': 'about 4 days ago', 'title': u'RT @saurabhsahni: RT @webmeme: Facebook To Open Office In Hyderabad, India http://bit.ly/cjQX1E', 'author': u'siddhantgoel', 'image_link': u'http://a3.twimg.com/profile_images/273389973/new3_normal.png', 'rawDate': u'Mon Mar 15 12:42:17 +0000 2010', 'link': u'http://twitter.com/siddhantgoel/status10515588603', 'rawdescription': u'RT+@saurabhsahni:+RT+@webmeme:+Facebook+To+Open+Office+In+Hyderabad,+India+http://bit.ly/cjQX1E'}, {'rawTime': 1268652780.0, 'description': u'RT @saurabhsahni: RT @webmeme: Facebook To Open Office In Hyderabad, India http://bit.ly/cjQX1E ', 'pubDate': 'about 4 days ago', 'title': u'RT @saurabhsahni: RT @webmeme: Facebook To Open Office In Hyderabad, India http://bit.ly/cjQX1E', 'author': u'narasimha', 'image_link': u'http://a3.twimg.com/profile_images/55124209/passport_normal.jpg', 'rawDate': u'Mon Mar 15 11:33:00 +0000 2010', 'link': u'http://twitter.com/narasimha/status10513370818', 'rawdescription': u'RT+@saurabhsahni:+RT+@webmeme:+Facebook+To+Open+Office+In+Hyderabad,+India+http://bit.ly/cjQX1E'}, {'rawTime': 1268643316.0, 'description': u'RT @saurabhsahni: RT @webmeme: Facebook To Open Office In Hyderabad, India http://bit.ly/cjQX1E ', 'pubDate': 'about 4 days ago', 'title': u'RT @saurabhsahni: RT @webmeme: Facebook To Open Office In Hyderabad, India http://bit.ly/cjQX1E', 'author': u'jac099', 'image_link': u'http://a1.twimg.com/profile_images/92003288/DSCN1553_normal.JPG', 'rawDate': u'Mon Mar 15 08:55:16 +0000 2010', 'link': u'http://twitter.com/jac099/status10509392759', 'rawdescription': u'RT+@saurabhsahni:+RT+@webmeme:+Facebook+To+Open+Office+In+Hyderabad,+India+http://bit.ly/cjQX1E'}, {'rawTime': 1268643228.0, 'description': u'RT @saurabhsahni: RT @webmeme: Facebook To Open Office In Hyderabad, India http://bit.ly/cjQX1E ', 'pubDate': 'about 4 days ago', 'title': u'RT @saurabhsahni: RT @webmeme: Facebook To Open Office In Hyderabad, India http://bit.ly/cjQX1E', 'author': u'manikumar', 'image_link': u'http://a1.twimg.com/profile_images/74056376/3095618210_0f71600dba_b_normal.jpg', 'rawDate': u'Mon Mar 15 08:53:48 +0000 2010', 'link': u'http://twitter.com/manikumar/status10509359933', 'rawdescription': u'RT+@saurabhsahni:+RT+@webmeme:+Facebook+To+Open+Office+In+Hyderabad,+India+http://bit.ly/cjQX1E'}, {'rawTime': 1267980657.0, 'description': u'RT @saurabhsahni: Heard: An average @mcdonalds burger is 3 months old deep frozen!!! ', 'pubDate': 'about 12 days ago', 'title': u'RT @saurabhsahni: Heard: An average @mcdonalds burger is 3 months old deep frozen!!!', 'author': u'mNHNw', 'image_link': u'http://a3.twimg.com/profile_images/53063633/images_normal.jpg', 'rawDate': u'Sun Mar 07 16:50:57 +0000 2010', 'link': u'http://twitter.com/mNHNw/status10126937837', 'rawdescription': u'RT+@saurabhsahni:+Heard:+An+average+@mcdonalds+burger+is+3+months+old+deep+frozen!!!'}, {'rawTime': 1267977395.0, 'description': u'RT @saurabhsahni: Heard: An average @mcdonalds burger is 3 months old deep frozen!!! ', 'pubDate': 'about 12 days ago', 'title': u'RT @saurabhsahni: Heard: An average @mcdonalds burger is 3 months old deep frozen!!!', 'author': u'mixdev', 'image_link': u'http://a1.twimg.com/profile_images/568060112/twitterProfilePhoto_normal.jpg', 'rawDate': u'Sun Mar 07 15:56:35 +0000 2010', 'link': u'http://twitter.com/mixdev/status10124965315', 'rawdescription': u'RT+@saurabhsahni:+Heard:+An+average+@mcdonalds+burger+is+3+months+old+deep+frozen!!!'}, {'rawTime': 1268397708.0, 'description': 'Mast kalandar is ok :| RT: @saurabhsahni: New Blog Post: Why are your Gulab Jamuns so expensive? http://bit.ly/c2mXfn #unpluggd', 'pubDate': 'about 7 days ago', 'title': 'Mast kalandar is ok :| RT: @saurabhsahni: New Blog Post: Why are your Gulab Jamuns so expensive? http://bit.ly/c2mXfn #unpluggd', 'author': '_UnPrEdictAbLe_', 'image_link': 'http://a1.twimg.com/profile_images/753497138/ritz_154_normal.jpg', 'rawDate': 'Fri, 12 Mar 2010 12:41:48 +0000', 'link': 'http://twitter.com/_UnPrEdictAbLe_/statuses/10369939465', 'rawdescription': 'Mast+kalandar+is+ok+:|+RT:+@saurabhsahni:+New+Blog+Post:+Why+are+your+Gulab+Jamuns+so+expensive?+http://bit.ly/c2mXfn+%23unpluggd'}]
get = itemgetter('rawTime')
thing.sort(key = get)
print thing