borisnikulin / discord-chat-analysis Goto Github PK
View Code? Open in Web Editor NEWText analysis of a discord chat group
License: MIT License
Text analysis of a discord chat group
License: MIT License
Hi!
I wanted to ask if there is a way to use this project with a file exported with DiscordChatExporter.
I think it would be really handy having some sort of compatibility.
Thank you for your work
Hi !
For some reasons when I run the script it returns an error : $ operator is invalid for atomic vectors
Then script stops.
I use Rstudio.
My guess is that it comes from those :
timestamps <- map(chat_json, ~.x$timestamp) %>% unlist() %>% ymd_hms()
usernames <- map(chat_json, ~.x$author$username) %>% unlist() %>% as.factor()
messages <- map(chat_json, ~.x$content) %>% unlist()
But I'm not sure how to fix it...
EDIT:
I replaced it by
timestamps <- map(chat_json, 'timestamp') %>% unlist() %>% ymd_hms()
usernames <- map(chat_json, c('author', 'username')) %>% unlist() %>% as.factor()
messages <- map(chat_json, 'content') %>% unlist()
It fixed it but now it shows more errors :
> tf_idf %>%
+ mutate(word = factor(word, levels = rev(unique(word)))) %>%
+ filter(tf < 1) %>%
+ group_by(username) %>%
+ top_n(30) %>%
+ ungroup() %>%
+ arrange(desc(tf_idf)) %>%
+ ggplot(aes(word, tf_idf, fill = username)) +
+ geom_col() +
+ facet_wrap(~username, ncol = 2, scales = 'free') +
+ coord_flip()
Selecting by tf_idf
Erreur : Faceting variables must have at least one value
_____________________________________________________________________________________
+ words %>%
+ pairwise_count(username, word, n, upper = T) %>%
+ graph_from_data_frame() %>%
+ ggraph(layout = "fr") +
+ geom_edge_link(aes(alpha = n, width = n)) +
+ geom_node_point(size = 6, color = "lightblue") +
+ geom_node_text(aes(label = name), repel = TRUE, color = 'red') +
+ theme_void()
Error in (function (cl, name, valueClass) :
assignment of an object of class “numeric” is not valid for @‘Dim’ in an object of class “dgTMatrix”; is(value, "integer") is not TRUE
______________________________________________________________________________________
> bigrams %>%
+ select(-username) %>%
+ filter(n > 11) %>%
+ graph_from_data_frame() %>%
+ ggraph(layout = "fr") +
+ geom_edge_link(aes(edge_alpha = n), show.legend = FALSE,
+ arrow = grid::arrow(type = "closed", length = unit(.15, "inches")),
+ end_cap = circle(.07, 'inches')) +
+ geom_node_point(color = "lightblue", size = 5) +
+ geom_node_text(aes(label = name), vjust = 1, hjust = 1) +
+ theme_void()
Don't know how to automatically pick scale for object of type function. Defaulting to continuous.
Erreur : Aesthetics must be valid data columns. Problematic aesthetic(s): edge_alpha = n.
Did you mistype the name of a data column or forget to add after_stat()?
________________________________________________________________________________________
> sentiments_afinn <- words %>%
+ inner_join(get_sentiments('afinn'))
Erreur : The textdata package is required to download the AFINN lexicon.
Install the textdata package to access this dataset.
>
> sentiments_afinn_count <- sentiments_afinn %>%
+ count(word, score, sort = T) %>%
+ ungroup()
Error in eval(lhs, parent, parent) : object 'sentiments_afinn' cannot be found
>
> sentiments_afinn %>%
+ group_by(username) %>%
+ summarise(sentiment = sum(score))
Error in eval(lhs, parent, parent) : object 'sentiments_afinn' cannot be found
___________________________________________________________________________________________
> mutate(word = reorder(word, nn)) %>%
+ ggplot(aes(word, nn, fill = score)) +
+ geom_col() +
+ facet_wrap(~score) +
+ coord_flip()
Error in unique.default(x, nmax = nmax) :
unique() s'applique seulement aux vecteurs
Thank you for your help
Hello!
Using RStudio, I followed the steps in #3, but when I Knit the README.Rmd file, I seem to be getting stuck at an error that occurs during the Bigram tokenization section.
The full output:
Quitting from lines 117-126 (README.Rmd)
Error in word1 %in% stop_words$word : object 'word1' not found
Calls: <Anonymous> ... eval_with_user_handlers -> eval -> eval -> %>% -> %in%
In addition: Warning messages:
1: Using `as.character()` on a quosure is deprecated as of rlang 0.3.0.
Please use `as_label()` or `as_name()` instead.
This warning is displayed once per session.
2: In remove && !as.character(col) %in% into :
'length(x) = 2 > 1' in coercion to 'logical(1)'
Execution halted
If you need any more info, please let me know!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.