Guest User

Untitled

a guest
Sep 24th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. ID | date | POS tagged text | pattern | ...
  2.  
  3. 123 | 2009-03-27 | gross_JJ domestic_JJ product_NN | the_DT most_NN | ...
  4.  
  5. step1 <- function(df){
  6. df %>%
  7. partition(variable, cluster=cl) %>%
  8. dplyr::filter(str_detect(phrases, paste(patternList, collapse = '|'))) %>%
  9. collect()
  10. }
  11.  
  12. preprocess <- function(p) {
  13. lapply(p, function(x) {
  14. x = gsub("\/\/", "_", x)
  15. })
  16. }
  17.  
  18. df$variable <- unlist(preprocess(df$variable))
  19.  
  20. ## Again using multidplyr and skipping some lines of code
  21. partition(source_code, cluster=cl) %>%
  22. mutate(match=str_detect(POStagged, pattern)) %>%
  23. filter(!(match==FALSE)) %>%
  24. filter(!is.na(match))
  25.  
  26. preprocess <- function(df) {
  27. lapply(df, function(POStagged, pattern) {
  28. mutate(p = str_detect(POStagged, pattern))
  29. filter(!(p==FALSE))
  30. filter(!is.na(p))
  31. })
  32. }
  33.  
  34. data_sample$match <- unlist(preprocess(data_sample))
  35.  
  36. Error in type(pattern) : argument "pattern" is missing, with no default
  37.  
  38. R version 3.4.4 (2018-03-15)
  39. Platform: x86_64-pc-linux-gnu (64-bit)
  40. Running under: Ubuntu 16.04.5 LTS
Add Comment
Please, Sign In to add comment