#' Lemmatizer
#'
#' This function allows you lemmatize words using the treetag lemmatizer
#' @param word word to lemmatize, if multiple use loop/apply/dplyr
#' @param print Whether to print word being lemmatized. Useful for long lists of words. Defaults to TRUE
#' @export
#' @examples
#' Lemmatize('hello')
Lemmatize = function(word, print =T){
if (print == T){
print(word)
}
lemmax = koRpus::treetag(as.character(word), treetagger="manual", format="obj", TT.tknz=FALSE , lang="en", TT.options=list(path="C:\\treetagger", preset="en"))
if(lemmax@TT.res[["lemma"]] == "<unknown>"){
return (lemmax@TT.res[["token"]])}
else
return(lemmax@TT.res[["lemma"]])
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.