change spelling of greens fraction, fix parsing issue in comments table

This commit is contained in:
2021-08-10 15:40:21 +02:00
parent c80ec6259e
commit 77f79f0d86
4 changed files with 32 additions and 25 deletions
+5 -2
View File
@@ -173,7 +173,8 @@ parse_speech <- function(speech_xml, date) {
}
fractionpattern <- "BÜNDNIS(SES)?\\W*90/DIE\\W*GRÜNEN|CDU/CSU|AfD|SPD|DIE LINKE|FDP|LINKEN"
fractionnames <- c("BÜNDNIS 90/DIE GRÜNEN", "CDU/CSU", "AfD", "SPD", "DIE LINKE", "FDP")
fractionnames <- c("BÜNDNIS 90/DIE GRÜNEN", "CDU/CSU", "AfD", "SPD", "DIE LINKE", "FDP",
"Fraktionslos")
parse_comment <- function(comment, speech_id, on_speaker) {
base <- c(speech_id = speech_id, on_speaker = on_speaker)
@@ -187,7 +188,9 @@ parse_comment <- function(comment, speech_id, on_speaker) {
c(base, type = "applause", fraction = by, commenter = NA_character_, content = comment)
} else {
ps <- str_match(comment, "(.*) \\[(.*?)\\]: (.*)")[1,]
c(base, type = "comment", fraction = ps[3], commenter = ps[2], content = ps[4])
fraction <- agrep(ps[3], fractionnames, max=0.2, value=T)
if (all(is.na(fraction)) || length(fraction) == 0) fraction <- NA_character_
c(base, type = "comment", fraction = fraction, commenter = ps[2], content = ps[4])
}
}