Learn R Programming

text (version 1.5)

textDimName: Change dimension names

Description

textDimName() changes the names of the dimensions in the word embeddings.

Usage

textDimName(word_embeddings, dim_names = TRUE, name = NULL)

Value

Word embeddings with changed names.

Arguments

word_embeddings

List of word embeddings or a single tibble

dim_names

Logical. If TRUE, the word embedding name or a custom name will be attached to the name of each dimension. If FALSE, the attached part of the name will be removed.

name

Optional character. If provided and dim_names = TRUE, this custom name will be attached after each column (e.g., dim1_name).

See Also

textEmbed

Examples

Run this code
# \donttest{
# Note that dimensions are called Dim1_harmonytexts etc.
word_embeddings_4$texts$harmonytexts

# Change to just Dim
w_e_T <- textDimName(word_embeddings_4$texts["harmonytexts"],
  dim_names = FALSE
)

# Change back to include the original name
w_e_F <- textDimName(w_e_T, dim_names = TRUE)

# Change and add a custom name
w_e_custom <- textDimName(w_e_T, dim_names = TRUE, name = "CustomName")
# }

Run the code above in your browser using DataLab