Skip to content

Commit

Permalink
changed drop_query with updated adaR
Browse files Browse the repository at this point in the history
  • Loading branch information
schochastics committed Oct 17, 2023
1 parent 2fe8c97 commit fa8ab71
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions R/preprocess.R
Original file line number Diff line number Diff line change
Expand Up @@ -338,19 +338,8 @@ extract_path <- function(wt, varname = "url") {
drop_query <- function(wt, varname = "url") {
abort_if_not_wtdt(wt)
vars_exist(wt, varname)
hash <- adaR::ada_get_hash(wt[[varname]])
search <- adaR::ada_get_search(wt[[varname]])
query <- paste0(search, hash)
idx <- which(query != "")
if (length(idx) != 0) {
no_query <- mapply(function(x, y) sub(x, "", y, fixed = TRUE), query[idx], wt[[varname]][idx], USE.NAMES = FALSE)
wt[[paste0(varname, "_noquery")]] <- wt[[varname]]
wt[[paste0(varname, "_noquery")]][idx] <- no_query
return(wt)
} else {
wt[[paste0(varname, "_noquery")]] <- wt[[varname]]
return(wt)
}
wt[[paste0(varname, "_noquery")]] <- adaR::ada_clear_hash(adaR::ada_clear_search(wt[[varname]]))
return(wt)
}

#' Parse parts of path for text analysis
Expand Down

0 comments on commit fa8ab71

Please sign in to comment.