feature_longwords: Long word features

Description Usage Arguments Details Value Examples

View source: R/feature_engineering.R

Description

Engineers features related to long words in Tweets.

Usage

1
2
feature_longwords(data, doc_id_field, text_field, top_num = 10,
  remove_urls = TRUE)

Arguments

data

a dataframe or tibble containing the text data and document id

doc_id_field

unquoted field name identifying the field within the data that represents the unique document id

text_field

unquoted field name identifying the field name in data that contains the text of the Tweet

top_num

integer, the top n long words to create features from

remove_urls

logical; should urls be removed prior to identifying long words

Details

Tweets are first converted to lowercase before the features are calculated. Twitter URLs (if remove_urls = TRUE), hashtags and @usernames are also removed.

The long word features are calculated as a proportion of the total number of words in the Tweet:

Value

A data frame of document ids their associated long word features

Examples

1
2
3
4
5
6
tweets <- data.frame(status_id = c(1234, 5678),
                     text = c("I tweeet about one thing #onething #things",
                              "I tweeet about otherthings #otherthings
                               #things"),
                     stringsAsFactors = FALSE)
feature_longwords(tweets, status_id, text)

sebastian-fox/twitterfeatures documentation built on Nov. 5, 2019, 8:47 a.m.