def generate_bot_answer(twitter_handle, user_question): tweets = (scrape(twitter_handle) if config.TWITTER_FETCHER == "scraper" else fetch(twitter_handle)) text_model = markovify.Text(clean_tweets_data(tweets)) return generate_bot_answer_with_text_model(twitter_handle, user_question, text_model)
def generate_bot_answer(twitter_handle, user_question): tweets = fetch(twitter_handle) clean_tweets = clean_tweets_data(tweets) text = "".join(map(str, clean_tweets)) text_model = markovify.Text(text) bot_answer = generate_bot_answer_with_text_model(twitter_handle, user_question, text_model) return bot_answer
def generate_bot_answer(twitter_handle, user_question): #tweets = get_user_tweets(twitter_handle) get_user-tweets to scrape to fetch tweets = fetch(twitter_handle) clean_tweets = clean_tweets_data(tweets) text = ''.join(map(str, clean_tweets)) #concat text_model = markovify.Text(text) #from library - build the model # bot_answer = None #bot_answer = generate_bot_answer_with_text_model(twitter_handle, user_question, text_model) word_list = user_question.split(' ') random_word = random.choice(word_list) #bot_answer = text_model.make_sentence_with_start(random_word, strict=False) text_model.make_sentence_with_start(random_word, strict=False) bot_answer = generate_bot_answer_with_text_model(twitter_handle, user_question, text_model) print("Print me if this function runs", bot_answer) return bot_answer