add option to lookup redner in repair and fix fraction list to ensure repaired tables are fixpoints of repair(, repair_comments = FALSE)
This commit is contained in:
+11
-3
@@ -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
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user