assign_codes: Assign codes

Description Usage Arguments Details Value Author(s) Examples

Description

It converts a sequence of words into a sequence of numerical identifier.

Usage

1
assign_codes(words, wordCode)

Arguments

words

Vector of strings (tokens)

wordCode

vector of strings (types)

Details

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.

Value

It returns the vector of words but now converted to a numerical identifier, which corresponds to the associated wordCode.

Author(s)

Rick Dale (rdale@ucla.edu)

Examples

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)
 

crqanlp documentation built on May 2, 2019, 1:09 p.m.