R/assign_codes.R

#' Assign a code with an existing list of words (indices used)
#' 
#' @param words vector of strings (tokens)
#' @param wordCode vector of strings (types)
#' @return a vector of numeric identifiers of lexical items

# NOTE: I thought that this function could have been used 
# to subcategorize words under the same numerical identifier 

.packageName <- 'crqanlp'

assign_codes = function(words,wordCode) {
  series = c()
  for (word in words) {
    series = c(series, which(word==wordCode))
  }
  return(series)
}

Try the crqanlp package in your browser

Any scripts or data that you put into this service are public.

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