Created
October 7, 2019 16:00
-
-
Save monogenea/e9d099891178d8b6059286c96d398663 to your computer and use it in GitHub Desktop.
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
# Tokenize words | |
tkn <- tokens(allTweets$text, | |
remove_twitter = T, | |
remove_separators = T, | |
remove_symbols = T, | |
remove_punct = T, | |
remove_url = T, | |
remove_hyphens = T, | |
remove_numbers = T) %>% | |
tokens_ngrams(n = 1:2) | |
gotDfm <- dfm(tkn, tolower = T, | |
remove = stopwords("english")) | |
gotChars <- c("jon", "cersei", "sansa", "arya", | |
"bran", "tyrion", "jaime", "daenerys", | |
"hound", "davos", "missandei", "theon", | |
"brienne", "gendry", "grey_worm", "jorah", | |
"night_king", "varys", "melisandre", "tormund") | |
gotFcm <- dfm_select(gotDfm, pattern = gotChars) %>% | |
fcm() | |
set.seed(100) | |
textplot_network(gotFcm, min_freq = 0.1, | |
edge_alpha = .25, | |
edge_size = 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment