Created
November 6, 2018 17:41
-
-
Save eoppe1022/a512b686cccc3ba16469183141fbd4ce to your computer and use it in GitHub Desktop.
Tweet Markov Bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(rtweet) | |
library(markovifyR) | |
## Get tweets with "rtweet" | |
## FYI you need to set up "rtweet" beforehand | |
yost_data <- get_timeline("@travisyost", n = 10000) | |
## Take out RTs and create Markov model | |
markov_model <- yost_data %>% | |
filter(is_retweet == FALSE) %>% | |
pull(text) %>% | |
generate_markovify_model(markov_state_size = 2) %>% | |
markovify_text(maximum_sentence_length = NULL, count = 25, tries = 100, only_distinct = TRUE) | |
## Print output | |
markov_model %>% | |
print(n = 25) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment