|
|
@ -59,7 +59,6 @@ query_gen_actors <- function(actor, country, pre_tags, post_tags) {
|
|
|
|
if (country == "no" | country == "dk") {
|
|
|
|
if (country == "no" | country == "dk") {
|
|
|
|
genitive <- 's'
|
|
|
|
genitive <- 's'
|
|
|
|
definitive <- 'en'
|
|
|
|
definitive <- 'en'
|
|
|
|
definitive_genitive <- 'ens'
|
|
|
|
|
|
|
|
} else if (country == 'uk') {
|
|
|
|
} else if (country == 'uk') {
|
|
|
|
genitive <- '\'s'
|
|
|
|
genitive <- '\'s'
|
|
|
|
} else if (country == 'nl' | country == 'be') {
|
|
|
|
} else if (country == 'nl' | country == 'be') {
|
|
|
@ -90,39 +89,37 @@ query_gen_actors <- function(actor, country, pre_tags, post_tags) {
|
|
|
|
|
|
|
|
|
|
|
|
### If actor is a minister, generate minister search
|
|
|
|
### If actor is a minister, generate minister search
|
|
|
|
if (actor$`_source.function` == "Minister" | actor$`_source.function` == "PM") {
|
|
|
|
if (actor$`_source.function` == "Minister" | actor$`_source.function` == "PM") {
|
|
|
|
# If country is no or dk, search for minister policy names (eg likestillingsminister) in both undefined, defined and genitive forms
|
|
|
|
|
|
|
|
if (country == "no" || country == "dk") {
|
|
|
|
if (country == "no" || country == "dk") {
|
|
|
|
capital <- unlist(lapply(actor$`_source.ministerSearch`, str_to_title))
|
|
|
|
minister <- str_split(actor$`_source.ministerSearch`, pattern = '-| ') %>%
|
|
|
|
capital_gen <- unlist(lapply(capital, str_c, genitive))
|
|
|
|
map(1)
|
|
|
|
gen <- unlist(lapply(actor$`_source.ministerSearch`, str_c, genitive))
|
|
|
|
|
|
|
|
capital_def <- unlist(lapply(capital, str_c, definitive))
|
|
|
|
capital <- unlist(str_to_title(minister))
|
|
|
|
capital_defgen <- unlist(lapply(capital, str_c, definitive_genitive))
|
|
|
|
capital_def <- unlist(str_c(capital, definitive))
|
|
|
|
def <- unlist(lapply(actor$`_source.ministerSearch`, str_c, definitive))
|
|
|
|
def <- unlist(str_c(minister,definitive))
|
|
|
|
defgen <- unlist(lapply(actor$`_source.ministerSearch`, str_c, definitive_genitive))
|
|
|
|
minister <- unlist(c(minister,capital,capital_def,def))
|
|
|
|
names <- paste(unlist(c(capital,capital_gen,gen,capital_def,def,defgen,capital_defgen)), collapse = '\\" OR \\"')
|
|
|
|
|
|
|
|
query_string <- paste0(query_string,') OR (',paste0(unlist(last_list), collapse = ' OR '),' AND (\\"',unlist(names),'\\"))')
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# If country is uk, search for last name and minister name in proximity (e.g "secretary Johnson"~5)
|
|
|
|
|
|
|
|
if (country == "uk") {
|
|
|
|
if (country == "uk") {
|
|
|
|
minister <- c(str_to_title(actor$`_source.ministerName`),
|
|
|
|
minister <- c(str_to_title(actor$`_source.ministerName`),
|
|
|
|
actor$`_source.ministerName`,
|
|
|
|
actor$`_source.ministerName`)
|
|
|
|
str_c(str_to_title(actor$`_source.ministerName`),genitive),
|
|
|
|
if(actor$`_source.function` == "PM") {
|
|
|
|
str_c(actor$`_source.ministerName`,genitive))
|
|
|
|
minister <- c(minister,
|
|
|
|
grid <- crossing(first = actor$`_source.lastName`, last = minister, prox = 5)
|
|
|
|
"PM")
|
|
|
|
ministername <- lapply(1:nrow(grid), prox_gen, grid = grid)
|
|
|
|
}
|
|
|
|
query_string <- paste0(query_string,') OR (',
|
|
|
|
|
|
|
|
paste0(unlist(ministername), collapse= ' OR '),')')
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (country == "nl" | country == "be") { # If country is nl or be, add a requirement for Minister to the query
|
|
|
|
if (country == "nl" | country == "be") { # If country is nl or be, add a requirement for Minister to the query
|
|
|
|
minister <- c('Minister',
|
|
|
|
minister <- c("Minister",
|
|
|
|
'minister',
|
|
|
|
"minister")
|
|
|
|
str_c('Minister',genitive),
|
|
|
|
if(actor$`_source.function` == "PM") {
|
|
|
|
str_c('minister',genitive))
|
|
|
|
minister <- c(minister,
|
|
|
|
grid <- crossing(first = actor$`_source.lastName`, last = minister, prox = 5)
|
|
|
|
"Premier",
|
|
|
|
ministername <- lapply(1:nrow(grid), prox_gen, grid = grid)
|
|
|
|
"premier")
|
|
|
|
query_string <- paste0(query_string,') OR (',
|
|
|
|
}
|
|
|
|
paste0(unlist(ministername), collapse= ' OR '),')')
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
grid <- crossing(first = last_list, last = minister, prox = 5)
|
|
|
|
|
|
|
|
ministername <- lapply(1:nrow(grid), prox_gen, grid = grid)
|
|
|
|
|
|
|
|
query_string <- paste0(query_string,') OR ((',
|
|
|
|
|
|
|
|
paste0(unlist(ministername), collapse= ' OR '),') AND ',
|
|
|
|
|
|
|
|
paste0('(',paste0(unlist(last_list), collapse = ' OR '),'))'))
|
|
|
|
} else { ### Else, generate search for first/last name only (MPs and Party leaders, currently)
|
|
|
|
} else { ### Else, generate search for first/last name only (MPs and Party leaders, currently)
|
|
|
|
query_string <- paste0(query_string,')')
|
|
|
|
query_string <- paste0(query_string,')')
|
|
|
|
}
|
|
|
|
}
|
|
|
|