Procházet zdrojové kódy

add option to lookup redner in repair and fix fraction list to ensure repaired tables are fixpoints of repair(, repair_comments = FALSE)

genderequality-alternative
flavis před 4 roky
rodič
revize
7771b2ebd8
1 změnil soubory, kde provedl 11 přidání a 3 odebrání
  1. +11
    -3
      R/repair.R

+ 11
- 3
R/repair.R Zobrazit soubor

@@ -1,4 +1,5 @@
fraktionen <- c("AFD" = "AfD",
"AFD&FRAKTIONSLOS" = "AfD&Fraktionslos",
"BÜNDNIS90/" = "BÜNDNIS 90 / DIE GRÜNEN",
"BÜNDNIS90/DIEGRÜNEN" = "BÜNDNIS 90 / DIE GRÜNEN",
"FRAKTIONSLOS" = "Fraktionslos",
@@ -84,13 +85,20 @@ repair_comments <- function(comments, redner) {

#' Repair parsed tables
#'
#' TODO: Explain repair_comments argument
#' (if TRUE, we try to lookup redner names in redner table)
#'
#' Possible test: check identical(repair(res), repair(repair(res))) == TRUE
#' Since repaired tables should be a fixpoint of repair.
#' @export
repair <- function(parse_output) {
repair <- function(parse_output, repair_comments = FALSE) {

list(redner = repair_redner(parse_output$redner),
reden = repair_reden(parse_output$reden),
talks = repair_talks(parse_output$talks),
#comments = repair_comments(parse_output$comments)
comments = parse_output$comments,
comments = if(repair_comments) repair_comments(parse_output$comments,
parse_output$redner)
else parse_output$comments,
applause = parse_output$applause
)
}

Načítá se…
Zrušit
Uložit