-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use options when using spacyr as step_tokenize engine #217
Comments
This is not possible because Since you have part of speech information you can use Below is just an example of how you would do this. You would need to expand vector passed to library(textrecipes)
short_data <- data.frame(text = c(
"This is a short tale,",
"With many cats and ladies.",
'I have 2 very important news for you. The 1st one is this!'
))
rec_spec <- recipe(~text, data = short_data) %>%
step_tokenize(text,
engine = 'spacyr') %>%
step_pos_filter(text, keep_tags = c("ADJ", "ADV", "NOUN", "VERB")) %>%
step_lemma(text) %>%
step_tf(text) %>%
prep()
rec_spec %>%
bake(new_data = NULL) %>%
glimpse()
#> Rows: 3
#> Columns: 11
#> $ tf_text_1st <int> 0, 0, 1
#> $ tf_text_cat <int> 0, 1, 0
#> $ tf_text_have <int> 0, 0, 1
#> $ tf_text_important <int> 0, 0, 1
#> $ tf_text_lady <int> 0, 1, 0
#> $ tf_text_many <int> 0, 1, 0
#> $ tf_text_news <int> 0, 0, 1
#> $ tf_text_one <int> 0, 0, 1
#> $ tf_text_short <int> 1, 0, 0
#> $ tf_text_tale <int> 1, 0, 0
#> $ tf_text_very <int> 0, 0, 1 Seeing this problem I am opening this issue to make it easier to remove unwanted tags #218 |
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue. |
The problem
I'm having trouble with providing options to step_tokenize when using spacyr engine
Reproducible example
The text was updated successfully, but these errors were encountered: