예제 #1
0
def get_esai_user (user_name, user_id):
	status_weight_factor = 0.5
	likes_weight_factor  = 0.3
	events_weight_factor = 0.2

	# calculating status factor
	status_count_of_user = snaide.get_statuses_count_by (user_name, user_id)
	total_status_count = snaide.get_all_statuses_count()
	comment_count_of_user = len ( snaide.get_comments_by(user_name, user_id) )
	total_comment_count = snaide.get_all_comments_count()

	status_factor = (status_count_of_user + comment_count_of_user)/float(total_status_count + total_comment_count) * 100 * status_weight_factor

	# calculating likes factor
	total_status_likes_count = snaide.get_all_status_likes_count()
	status_id_list = snaide.get_statuses_by (user_name, user_id)
	status_likes_count_user = 0
	for status_id in status_id_list:
		status_likes_count_user = status_likes_count_user + snaide.get_likes_on_single_status(status_id)

	likes_factor = ( status_likes_count_user/float(total_status_likes_count) ) * 100 * likes_weight_factor


	#calculating the event factor
	event_id_list = snaide.get_events_attended_by(user_name , user_id)
	event_attendees_count = 0
	events_factor = 25
	for event_id in event_id_list:
		event_attendees_count = event_attendees_count + snaide.get_event_attendees_count(None, event_id)


	return status_factor + likes_factor + events_factor
print snaide.is_user_member_of_group(user_id, group_id)
print


print snaide.groups_with_user_as_member(None, user_guid)
print

print snaide.get_all_blogs()
print


print snaide.get_statuses_count_by(None, user_guid)
print


print snaide.get_likes_on_single_status(status_id)
print


print snaide.get_events_attended_by(None, user_guid)
print


print snaide.get_all_groups()
print


print snaide.get_status_message(status_id)
print

예제 #3
0
pages_sum = 0
comments_sum = 0
statuses_count = 0
status_likes_count = 0
blogs_count = 0
blog_likes_count = 0
groups_count = 0
groups = set([])

for friend in friends:
	pages_sum = pages_sum + len(snaide.get_pages_liked_by(None, friend))
	comments_sum = comments_sum + len(snaide.get_comments_by(None, friend))
	statuses = snaide.get_statuses_by(None, friend)
	statuses_count = statuses_count + len(statuses)
	for status_id in statuses:
		status_likes_count = status_likes_count + snaide.get_likes_on_single_status(status_id)

	blogs = snaide.get_blogs_by_user(None, friend)
	blogs_count = blogs_count + len(blogs)
	for blog_id in blogs:
		blog_likes_count = blog_likes_count + snaide.get_blog_likers_count(None, blog_id)

	for g in snaide.groups_with_user_as_member(None, friend):
		groups.add ( g )
	
groups_count = groups_count + len(groups)

print "Average Pages Liked by Friends : "+str(pages_sum/friends_count)
print "Average Comments by Friends : "+str(comments_sum/friends_count)
print "Average Statuses posted by Friends : "+str(statuses_count/friends_count)
print "Average Likes on Statuses by Friends : "+str(status_likes_count/friends_count)