Description Usage Arguments Details Value Author(s) Examples
It converts a sequence of words into a sequence of numerical identifier.
1 | assign_codes(words, wordCode)
|
words |
Vector of strings (tokens) |
wordCode |
vector of strings (types) |
Imagine we want to treat all words from the semantic category of animals in the same way. This function would allow the user to assign to different words, e.g, cat, dog or bird, the same identifier, e.g., 1. Note, words and wordCode need to have the same length.
It returns the vector of words but now converted to a numerical identifier, which corresponds to the associated wordCode.
Rick Dale (rdale@ucla.edu)
1 2 3 4 5 | library(corpus)
words = c("bad", "bed", "joy", "sad") # words that we wish to locate in affect_wordnet
wordCode = affect_wordnet[,1] # all words in affect_wordnet
assign_codes(words, wordCode)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.