-
-
Save nszoni/1d7c7efc78ae6f259f8d920002ed76fc to your computer and use it in GitHub Desktop.
Get entities
This file contains 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
#init empty vector | |
entities <- c() | |
#get entities and append to vector | |
for (i in 1:length(hungary_processed$text_processed)){ | |
entry <- detect_entities(hungary_processed$text_processed[i]) | |
if (ncol(entry) > 1){ | |
entities <- c(entities, entry[, 5]) | |
log_info("Found entities for post {i}") | |
} else { | |
log_info("Found NO entities for post {i}, skipping") | |
} | |
} | |
#extract top 10 | |
entity_freq <- data.frame(sort(table(wordStem(entities, 'en')), decreasing = TRUE)) %>% | |
slice(1:10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment