diff --git a/R/repair.R b/R/repair.R index 21d5738..ba62357 100644 --- a/R/repair.R +++ b/R/repair.R @@ -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 ) }