def pickle_category_counts_distribution():
results = {}
db = MySQLDatabase(DATABASE_HOST, DATABASE_USER, DATABASE_PASSWORD, DATABASE_NAME)
db_worker_view = db.get_work_view()
cursor = db_worker_view._cursor
for category in ['lead', 'infobox', 'body', 'left-body', 'navbox']:
try:
cursor.execute('select counts from link_features where counts is not null and visual_region=%s;', (category,))
result = cursor.fetchall()
results[category] = result
except MySQLdb.Error, e:
print e
try:
cursor.execute('select counts from clickstream_derived_internal_links;')
result = cursor.fetchall()
results['counts'] = result
except MySQLdb.Error, e:
print e
write_pickle(HOME+'output/category_counts_distribution.obj', results)
评论列表
文章目录