
#install.packages("textstem",repos = "http://cran.us.r-project.org")
#install.packages("udpipe",repos = "http://cran.us.r-project.org")
library(textstem)

# first vector of words:
vector1 <- c("eat", "ate", "eaten")
print("vector of words:")
print(vector1)
print("lemmatized vector of words:")
lemmatize_words(vector1)
cat("\n")

# second vector of words:
vector2 <- c("am", "be", "was")
print("vector of words:")
print(vector2)
print("lemmatized vector of words:")
lemmatize_words(vector2)
cat("\n")

# lemmatize a corpus:
library(udpipe)
docs <- c(doc_a = "When ignorance is bliss, 'tis folly to be wise said the Bard",
          doc_b = "Gambarimasho means let's try our best")
anno <- udpipe(docs, "english")
anno[, c("doc_id", "sentence_id", "token", "lemma", "upos")]

