improve applause party parsing

This commit is contained in:
2021-07-01 13:23:29 +02:00
parent f09cbac172
commit 2abb3467e8
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -137,12 +137,14 @@ parse_rede <- function(rede_xml) {
comments = comments)
}
fraktionspattern <- "BÜNDNIS 90/DIE GRÜNEN|CDU/CSU|AfD|SPD|DIE LINKE|FDP"
fraktionspattern <- "BÜNDNIS(SES)?\\W*90/DIE\\W*GRÜNEN|CDU/CSU|AfD|SPD|DIE LINKE|FDP|LINKEN"
fraktionsnames <- c("BÜNDNIS 90/DIE GRÜNEN", "CDU/CSU", "AfD", "SPD", "DIE LINKE", "FDP")
parse_comment <- function(comment, rede_id, on_redner) {
base <- c(rede_id = rede_id, on_redner = on_redner)
str_extract_all(comment, fraktionspattern) %>%
`[[`(1) %>%
sapply(partial(flip(head), 1) %.% agrep, x=fraktionsnames, max=0.2, value=T) %>%
str_c(collapse=",") ->
by
# classify comment