feature_emoji: Emoji features

Description Usage Arguments Details Value Examples

View source: R/feature_engineering.R

Description

Engineers features related to emojis in Tweets.

Usage

1
feature_emoji(data, doc_id_field, text_field, top_num = 20)

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 emojis to create features from

Details

The full list of emojis are initially downloaded from https://unicode.org/Public/emoji/12.0/emoji-test.txt so an internet connection is required.

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

Value

A data frame of document ids their associated emoji features

Examples

1
2
3
4
5
tweets <- data.frame(status_id = c(1234, 5678),
                     text = c("I tweet about one thing \U0001f602 #onething #things \U0001f600",
                              "I tweet about another thing \U0001f602 #another thing #things"),
                     stringsAsFactors = FALSE)
feature_emoji(tweets, status_id, text)

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