mkearney / textfeatures

👷‍♂️ A simple package for extracting useful features from character objects 👷‍♀️
https://textfeatures.mikewk.com
Other
166 stars 17 forks source link

How to apply textfeatures to a newdata? #6

Closed turgut090 closed 3 years ago

turgut090 commented 5 years ago

Hi, Could you explain/clarify how to apply train preprocessing to new data?

newdata - If a textfeatures_model is supplied to text, supply this with new data to which you would like ???to apply the textfeatures_model.???

Cause after textfeatures function I get a data frame.

mkuehn10 commented 4 years ago

I am wondering this as well. I see a textfeatures.textfeatures_model in newdata.R, but I don't see anywhere else how to get an object of this type.

smingerson commented 4 years ago

Below is an example on how to extract the object of class "textfeatures_model" for use on future data.

library(textfeatures)
rt <- rtweet::search_tweets("rstats", n = 2000, verbose = FALSE)
tf <- textfeatures(rt$text)
tf_model <- attr(tf, "tf_export", exact = TRUE)
py <- rtweet::search_tweets('python', n = 2000, verbose = FALSE)
textfeatures(tf_model, newdata = py$text)
turgut090 commented 3 years ago

Hi, everyone. I see that this package is no longer supported. I am closing it.