Skip to content

Commit 7a1395a

Browse files
authored
Merge pull request #640 from rstudio/fit_text_tokenizer_enhancement
allow passing generator functions to fit_text_tokenizer
2 parents 544baea + 2879076 commit 7a1395a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

R/preprocessing.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ fit_text_tokenizer <- function(object, x) {
311311
if (is.list(x))
312312
tokenizer$fit_on_sequences(x)
313313
else {
314-
tokenizer$fit_on_texts(as_texts(x))
314+
tokenizer$fit_on_texts(if (is.function(x)) reticulate::py_iterator(x) else as_texts(x))
315315
}
316316
invisible(tokenizer)
317317
}

0 commit comments

Comments
 (0)