def get_user_timeline(user_name): out = db_handler(host_='localhost', port_=27017, db_name_='ttr_exp') engine = tweepy_engine(out=out) user = engine.get_user_info(user_name) user._id = user.name_ out.save_user(user.serialise()) return user
from analysing_data import markov_chain_machine from analysing_data.markov_chain_machine import markov_chain import text_proc.text_processing as tp from analysing_data.booster import db_mc_handler from model.db import db_handler from search_engine.twitter_engine import tweepy_engine from analysing_data.mc_difference_logic import diff_markov_chains import tools __author__ = '4ikist' db = db_handler(host_='localhost', port_=27017, db_name_='ttr_exp') boost = db_mc_handler() engine = tweepy_engine(out=db) def get_users_data(user_name1, user_name2): user1 = engine.get_user_info(user_name1) user2 = engine.get_user_info(user_name2) db.save_user(user1.serialise()) db.save_user(user2.serialise()) timeline1 = tools.flush(user1.timeline, by_what=lambda x: tp.get_words(x['text'], is_normalise=True))[:10] timeline2 = tools.flush(user2.timeline, by_what=lambda x: tp.get_words(x['text'], is_normalise=True))[:10] print len(timeline1) print len(timeline2) mc1 = markov_chain_machine.create_model(timeline1, user_name1, boost) mc2 = markov_chain_machine.create_model(timeline2, user_name2, boost) return mc1, mc2
def load_users_by_star_friend(star_name): engine = tweepy_engine(out=db_handler(host_='localhost', port_=27027, db_name_='ttr_test')) engine.get_relations_of_user(star_name)
from analysing_data import mc_difference_logic from analysing_data.booster import db_mc_handler from analysing_data.markov_chain_machine import markov_chain import loggers from model.db import db_handler from search_engine import twitter_engine from search_engine.twitter_engine import tweepy_engine import tools from visualise import vis_machine __author__ = '4ikist' db_ = db_handler(truncate=False) api_engine = twitter_engine.tweepy_engine(out=db_) booster = db_mc_handler(truncate=False) vis_processor = vis_machine log = loggers.logger def model_splitter(message): message_ = message.split() return message_ def process_names(file_name, class_name): """ get from file ser names, scrapping saving and forming markov chains for any user timeline """