add repair stubs

This commit is contained in:
2021-06-24 16:08:25 +02:00
parent 2c7b99c942
commit ee8fdfd33c
+38
View File
@@ -0,0 +1,38 @@
source("../utils/helpers.R")
fraktionen <- c("AFD" = "AfD",
"BÜNDNIS90/" = "BÜNDNIS 90 / DIE GRÜNEN",
"BÜNDNIS90/DIEGRÜNEN" = "BÜNDNIS 90 / DIE GRÜNEN",
"FRAKTIONSLOS" = "Fraktionslos",
"DIELINKE" = "DIE LINKE",
"SPD" = "SPD",
"CDU/CSU" = "CDU/CSU",
"FDP" = "FDP")
# expects a tibble of redner and repairs
repair_fraktion <- function(fraktion) {
cleaned <- str_to_upper %$% str_replace_all(fraktion, "\\s", "")
fraktionen[cleaned]
}
repair_redner <- function(redner) {
# fix fraktionsnames
redner %>% mutate(fraktion = Vectorize(repair_fraktion)(fraktion))
}
repair_reden <- function(reden) {
# TODO: fill with content
reden
}
repair_talks <- function(talks) {
# TODO: fill with content
talks
}
# repairs all tables
repair <- function(parse_output) {
list(redner = repair_redner(parse_output$redner),
reden = repair_reden(parse_output$reden),
talks = repair_talks(parse_output$talks))
}