24 lines
650 B
R
24 lines
650 B
R
create_glossardict <- function(items, glossar_files, xmlpath) {
|
|
|
|
x <- NULL
|
|
|
|
for (glossar_file in glossar_files) {
|
|
for (item in items) {
|
|
fnames <- dir(pattern = paste0(item, "_"), path = paste0(xmlpath, item))
|
|
for (fname in fnames) {
|
|
suppressWarnings(
|
|
lines <- readLines(paste0(xmlpath, item, "/", fname))
|
|
)
|
|
if (any(grepl(glossar_file, lines))) {
|
|
x <- rbind(x, data.frame(glossar_file, item))
|
|
break # if one match is found, we are done
|
|
}
|
|
}
|
|
}
|
|
}
|
|
tapply(x$item, x$glossar_file, FUN = c)
|
|
}
|
|
# TODO: Get rid of (at least 2) loops
|
|
# TODO: Add progress bars
|
|
|