1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-11 17:41:57 +02:00

(v1.2.0.9016) fix in rsi_calc()

This commit is contained in:
2020-06-26 10:21:22 +02:00
parent 033ca49817
commit b31003c0b6
21 changed files with 71 additions and 61 deletions

View File

@ -58,12 +58,17 @@ ab_from_text <- function(text, collapse = NULL, translate_ab = "name", ...) {
}
text_split <- unlist(strsplit(text, "[ ;.,:/\\|-]"))
result <- as.ab(unique(c(text_split[grep(to_regex(abbr), text_split)],
text_split[grep(to_regex(names), text_split)],
# regular expression must not be too long, so split synonyms in two:
text_split[grep(to_regex(synonyms[c(1:0.5 * length(synonyms))]), text_split)],
text_split[grep(to_regex(synonyms[c(0.5 * length(synonyms):length(synonyms))]), text_split)])),
...)
result <- suppressWarnings(
as.ab(unique(c(text_split[grep(to_regex(abbr), text_split)],
text_split[grep(to_regex(names), text_split)],
# regular expression must not be too long, so split synonyms in two:
text_split[grep(to_regex(synonyms[c(1:0.5 * length(synonyms))]), text_split)],
text_split[grep(to_regex(synonyms[c(0.5 * length(synonyms):length(synonyms))]), text_split)])),
...))
result <- result[!is.na(result)]
if (length(result) == 0) {
result <- as.ab(NA)
}
translate_ab <- get_translate_ab(translate_ab)
if (!isFALSE(translate_ab)) {
result <- ab_property(result, property = translate_ab)