y_other = [] text_other = [] x_all = [] y_all = [] x_male = [] y_male = [] text_male = [] x_female = [] y_female = [] text_female = [] for handle, magnitude in dictionaryByValue(tweet_density): subject = get_values(handle=handle)[0] print(subject['name']) x_all.append(magnitude) y_all.append(deleted_density[handle]) if subject['sex'] == 'male': text_male.append(subject['name']) x_male.append(magnitude) y_male.append(deleted_density[handle]) else: text_female.append(subject['name']) x_female.append(magnitude) y_female.append(deleted_density[handle])
my_suspended_deleted_list = [] subjects_dict = {} stance_count = {} with open('closed_accounts.txt', mode='r') as fs: for account in fs: my_deleted_list.append(account.strip().lower()) my_suspended_deleted_list.append(account.strip().lower()) with open('suspended.txt', mode='r') as fs: for account in fs: my_suspended_list.append(account.strip().lower()) my_suspended_deleted_list.append(account.strip().lower()) # get political stance for all Twitter observed accounts for account in get_values(): subjects_dict[account['handle'].lower()] = {'stance': account['stance']} if account['stance'] not in stance_count: stance_count[account['stance']] = 1 else: stance_count[account['stance']] += 1 max_density = 0 handle_max_density = '' is_tweet_density = True appearance = {} print( observed.handle_text_conversation_replies('iamsambee', '885869337063686144', 'camarogirl91'))
import numpy as np import plotly from twitter_apps.Subjects import get_values plotly.offline.init_notebook_mode(connected=True) with open('data/account_features.pkl', mode='rb') as fhd: obj = pickle.load(fhd) x = list(range(1, len(obj) + 1)) y = [] text = [] values = [] for account in obj: subject = get_values(handle=account)[0] print(subject['name']) print( 'User-name: {}, Number of appearances across conversations: {}, Ave. appearances across conversations: {}' .format(account, obj[account]['appearance-across-conversation-count'], obj[account]['ave-handle-appearance-across-conversation'])) values.append((obj[account]['appearance-across-conversation-count'], subject['name'])) #for feature in obj[account]: # print('\t{}: {}'.format(feature, obj[account]['ave-handle-appearance-across-conversation'])) print(len(obj))
my_suspended_deleted_list = [] subjects_dict = {} stance_count = {} with open('closed_accounts.txt', mode='r') as fs: for account in fs: my_deleted_list.append(account.strip().lower()) my_suspended_deleted_list.append(account.strip().lower()) with open('suspended.txt', mode='r') as fs: for account in fs: my_suspended_list.append(account.strip().lower()) my_suspended_deleted_list.append(account.strip().lower()) # get political stance for all Twitter observed accounts for account in get_values(): subjects_dict[account['handle'].lower()] = {'stance': account['stance']} if account['stance'] not in stance_count: stance_count[account['stance']] = 1 else: stance_count[account['stance']] += 1 max_density = 0 handle_max_density = '' is_tweet_density = True appearance = {} total_number_tweets = 0 total_number_handles = 0 total_number_conversations = 0 total_number_handles_in_conversation = 0
from twitter_apps.Subjects import get_values from twitter_apps.TwitterFunctions import TwitterObject all_handles = [] for account in get_values(): print(account['handle']) all_handles.append(account['handle']) my_api = TwitterObject() user_ids = my_api.api.lookup_users(screen_names=all_handles[:100]) for user in user_ids: print(user.screen_name, user.id) user_ids = my_api.api.lookup_users(screen_names=all_handles[100:]) print() print(all_handles[99:105]) print() for user in user_ids: print(user.screen_name, user.id)
y4 = [] text5 = [] x5 = [] y5 = [] with open('closed_accounts.txt', mode='r') as fs: for account in fs: my_deleted_list.append(account.strip().lower()) my_suspended_deleted_list.append(account.strip().lower()) with open('suspended.txt', mode='r') as fs: for account in fs: my_suspended_list.append(account.strip().lower()) my_suspended_deleted_list.append(account.strip().lower()) for current_handle in get_values(): del_rows, all_handles = observed.handle_conversation_matrix( current_handle['handle'], my_suspended_deleted_list) all_rows = observed.handle_conversations_id(current_handle['handle']) deleted_amount[current_handle['handle']] = 0 for row in del_rows: for handle in row[list(row)[0]]: deleted_amount[current_handle['handle']] += row[list(row) [0]][handle] deleted_percent = len(del_rows) / len(all_rows) deleted_data[current_handle['handle']] = deleted_percent subjects_dict[current_handle['handle']] = current_handle['name'] print(deleted_amount[current_handle['handle']])