Skip to content

Commit

Permalink
verify that fit object exists before calling transform() by checking …
Browse files Browse the repository at this point in the history
…for vocab existence
  • Loading branch information
leungi committed Feb 29, 2020
1 parent 90896b2 commit ddfb671
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions R/model_Collocations.R
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ Collocations = R6::R6Class(
invisible(self$collocation_stat)
},
transform = function(it) {
if(is.null(private$vocabulary))
stop("fit object is missing. Please run fit() method first before transform().")
# if pointer is invalid - init it
if(is.null(private$phrases_ptr) || is_invalid_ptr(private$phrases_ptr))
private$phrases_ptr = create_xptr_unordered_set(private$phrases)
Expand Down

0 comments on commit ddfb671

Please sign in to comment.